MCPcopy Create free account
hub / github.com/apache/arrow / run_cmd

Function run_cmd

dev/archery/archery/integration/util.py:131–154  ·  view source on GitHub ↗
(cmd, **kwargs)

Source from the content-addressed store, hash-verified

129
130
131def run_cmd(cmd, **kwargs):
132 if isinstance(cmd, str):
133 cmd = cmd.split(' ')
134
135 try:
136 kwargs.update(stderr=subprocess.STDOUT)
137 output = subprocess.check_output(cmd, **kwargs)
138 except subprocess.CalledProcessError as e:
139 # this avoids hiding the stdout / stderr of failed processes
140 sio = io.StringIO()
141 command_line_string = ''
142 env = kwargs.get('env', {})
143 for key in env.keys() - os.environ.keys():
144 value = env[key]
145 command_line_string += f'{key}={value} '
146 command_line_string += ' '.join(cmd)
147 print(f'Command failed: {command_line_string}', file=sio)
148 print('With output:', file=sio)
149 print('--------------', file=sio)
150 print(frombytes(e.output), file=sio)
151 print('--------------', file=sio)
152 raise RuntimeError(sio.getvalue())
153
154 return frombytes(output)
155
156
157# Adapted from CPython

Callers 15

_runMethod · 0.70
flight_requestMethod · 0.70
_runMethod · 0.70
flight_requestMethod · 0.70
_runMethod · 0.70
_runMethod · 0.70
stream_to_fileMethod · 0.70
file_to_streamMethod · 0.70
flight_requestMethod · 0.70
_runMethod · 0.70
flight_requestMethod · 0.70
_runMethod · 0.70

Calls 4

frombytesFunction · 0.85
getMethod · 0.45
keysMethod · 0.45
joinMethod · 0.45

Tested by 15

_runMethod · 0.56
flight_requestMethod · 0.56
_runMethod · 0.56
flight_requestMethod · 0.56
_runMethod · 0.56
_runMethod · 0.56
stream_to_fileMethod · 0.56
file_to_streamMethod · 0.56
flight_requestMethod · 0.56
_runMethod · 0.56
flight_requestMethod · 0.56
_runMethod · 0.56