MCPcopy
hub / github.com/corpnewt/gibMacOS / _run_command

Method _run_command

Scripts/run.py:83–95  ·  view source on GitHub ↗
(self, comm, shell = False)

Source from the content-addressed store, hash-verified

81 return value
82
83 def _run_command(self, comm, shell = False):
84 c = None
85 try:
86 if shell and type(comm) is list:
87 comm = " ".join(shlex.quote(x) for x in comm)
88 if not shell and type(comm) is str:
89 comm = shlex.split(comm)
90 p = subprocess.Popen(comm, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
91 c = p.communicate()
92 except:
93 if c == None:
94 return ("", "Command not found!", 1)
95 return (self._decode(c[0]), self._decode(c[1]), p.returncode)
96
97 def run(self, command_list, leave_on_fail = False):
98 # Command list should be an array of dicts

Callers 1

runMethod · 0.95

Calls 1

_decodeMethod · 0.95

Tested by

no test coverage detected