MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / run_command

Function run_command

scripts/export-import-test.py:35–56  ·  view source on GitHub ↗
(cmd, cwd=None, capture_output=False, check=True)

Source from the content-addressed store, hash-verified

33
34
35def run_command(cmd, cwd=None, capture_output=False, check=True):
36 print(f"> Running: {cmd} (cwd={cwd})")
37
38 # We redirect stdin to devnull in an attempt
39 # to stop the process from interfering with the terminal's input buffer.
40 # This needs some work. After running the script I found that my buffer
41 # was filled with a sequence like 8;1R8;1R8;1R8;1R8;... This doesn't seem
42 # to affect the script but is annoying.
43 result = subprocess.run(
44 cmd,
45 cwd=cwd,
46 text=True,
47 capture_output=capture_output,
48 check=check,
49 shell=True,
50 stdin=subprocess.DEVNULL,
51 )
52 if capture_output:
53 return result.stdout.strip()
54 else:
55 print(result.stdout or "")
56 return None
57
58
59def export_datasets_and_test(

Callers 4

create_worktreeFunction · 0.85
remove_worktreeFunction · 0.85
export_datasets_and_testFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected