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

Function run_command

utils/apply_code_fixes.py:165–182  ·  view source on GitHub ↗

Run a shell command and return whether it succeeded. Args: cmd: The command to run. file_path: The file being processed (for error reporting). Returns: True if the command succeeded, False otherwise.

(cmd: List[str], file_path: str)

Source from the content-addressed store, hash-verified

163
164
165def run_command(cmd: List[str], file_path: str) -> bool:
166 """Run a shell command and return whether it succeeded.
167
168 Args:
169 cmd: The command to run.
170 file_path: The file being processed (for error reporting).
171
172 Returns:
173 True if the command succeeded, False otherwise.
174 """
175 try:
176 subprocess.run(cmd, check=True, capture_output=True, text=True)
177 return True
178 except subprocess.CalledProcessError as e:
179 print(f"Error processing {file_path}: {e}", file=sys.stderr)
180 print(f"stdout: {e.stdout}", file=sys.stderr)
181 print(f"stderr: {e.stderr}", file=sys.stderr)
182 return False
183
184
185def fix_from_pycodestyle(

Callers 1

fix_fileFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…