MCPcopy Index your code
hub / github.com/streamlit/streamlit / run_commands

Function run_commands

scripts/run_bare_execution_tests.py:79–104  ·  view source on GitHub ↗

Run a list of commands, displaying them within the given section.

(section_header: str, commands: list[str])

Source from the content-addressed store, hash-verified

77
78
79def run_commands(section_header: str, commands: list[str]) -> list[str]:
80 """Run a list of commands, displaying them within the given section."""
81
82 pool = ThreadPool(processes=max(1, multiprocessing.cpu_count() - 1))
83 lock = Lock()
84 failed_commands = []
85
86 def process_command(arg: tuple[int, str]) -> None:
87 i, command = arg
88
89 # Display the status.
90 click.secho(
91 f"\nRunning {section_header} {i + 1}/{len(commands)} : {_command_to_string(command)}",
92 bold=True,
93 )
94
95 # Run the command.
96 result = subprocess.call(
97 command.split(" "), stdout=subprocess.DEVNULL, stderr=None
98 )
99 if result != 0:
100 with lock:
101 failed_commands.append(command)
102
103 pool.map(process_command, enumerate(commands))
104 return failed_commands
105
106
107def main() -> None:

Callers 1

mainFunction · 0.85

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…