MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / _run

Method _run

bmtools/tools/shell/api.py:74–91  ·  view source on GitHub ↗

Run commands and return final output.

(self, command: str)

Source from the content-addressed store, hash-verified

72 return self._run(commands)
73
74 def _run(self, command: str) -> str:
75 """Run commands and return final output."""
76 print("entering _run")
77 try:
78 output = subprocess.run(
79 command,
80 shell=True,
81 check=True,
82 stdout=subprocess.PIPE,
83 stderr=subprocess.STDOUT,
84 ).stdout.decode()
85 except subprocess.CalledProcessError as error:
86 if self.return_err_output:
87 return error.stdout.decode()
88 return str(error)
89 if self.strip_newlines:
90 output = output.strip()
91 return output
92
93 def process_output(self, output: str, command: str) -> str:
94 # Remove the command from the output using a regular expression

Callers 1

runMethod · 0.95

Calls 1

runMethod · 0.45

Tested by

no test coverage detected