MCPcopy Create free account
hub / github.com/FastLED/FastLED / run_command

Function run_command

ci/util/symbol_analysis.py:116–149  ·  view source on GitHub ↗

Run a command and return stdout

(cmd: str)

Source from the content-addressed store, hash-verified

114
115
116def run_command(cmd: str) -> str:
117 """Run a command and return stdout"""
118 try:
119 proc = RunningProcess(cmd, shell=True, auto_run=True, timeout=30)
120 from running_process import EndOfStream
121
122 # `get_next_line` strips the trailing newline. Re-add it so callers
123 # that `output.split("\n")` actually get one entry per line rather
124 # than a single mega-line that no parser can split on whitespace
125 # (the cause of "nm: 1 symbols" on toolchains like xtensa-esp-elf
126 # whose nm prints many hundreds of lines).
127 output_lines: list[str] = []
128 while line := proc.get_next_line(timeout=30):
129 if isinstance(line, EndOfStream):
130 break
131 output_lines.append(str(line))
132 output = "\n".join(output_lines)
133 exit_code = proc.wait()
134 if exit_code != 0:
135 print(f"Error running command: {cmd}")
136 print(f"Exit code: {exit_code}")
137 return ""
138 return output
139 except KeyboardInterrupt as ki:
140 from ci.util.global_interrupt_handler import (
141 handle_keyboard_interrupt,
142 )
143
144 handle_keyboard_interrupt(ki)
145 raise
146 except Exception as e:
147 print(f"Error running command: {cmd}")
148 print(f"Error: {e}")
149 return ""
150
151
152def demangle_symbol(mangled_name: str, cppfilt_path: str) -> str:

Callers 2

analyze_symbolsFunction · 0.70
analyze_function_callsFunction · 0.70

Calls 4

printFunction · 0.50
appendMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected