MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / run_command

Function run_command

methods/MIRIX/scripts/reset_database.py:132–142  ·  view source on GitHub ↗

Run a subprocess command with error handling.

(cmd: list, check: bool = True)

Source from the content-addressed store, hash-verified

130
131
132def run_command(cmd: list, check: bool = True) -> subprocess.CompletedProcess:
133 """Run a subprocess command with error handling."""
134 try:
135 result = subprocess.run(cmd, capture_output=True, text=True, check=check)
136 return result
137 except subprocess.CalledProcessError as e:
138 if check:
139 log_error(f"Command failed: {' '.join(cmd)}")
140 log_error(f"Error: {e.stderr.strip() if e.stderr else str(e)}")
141 raise
142 return e
143
144
145def reset_postgresql(host: str = None, port: str = None, user: str = None, database: str = None):

Callers 1

reset_postgresqlFunction · 0.85

Calls 3

log_errorFunction · 0.85
runMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected