MCPcopy Create free account
hub / github.com/Pometry/Raphtory / execute_bash_command

Function execute_bash_command

raphtory-benchmark/python/neo4j_bench.py:65–82  ·  view source on GitHub ↗
(command, background=False, timeout=60)

Source from the content-addressed store, hash-verified

63
64
65def execute_bash_command(command, background=False, timeout=60):
66 print("Executing command: ", command)
67 if background:
68 subprocess.Popen(
69 command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
70 )
71 return
72 try:
73 child = pexpect.spawn(
74 "/bin/bash", ["-c", command + " 2>&1"], timeout=timeout
75 ) # Redirect stderr to stdout
76 child.expect(pexpect.EOF)
77 output = child.before.decode("utf-8")
78 except pexpect.TIMEOUT:
79 print("Command timed out")
80 child.terminate(force=True)
81 output = None
82 return output
83
84
85def write_array_to_csv(arr, file_path):

Callers 2

import_dataFunction · 0.85
setupMethod · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected