MCPcopy Create free account
hub / github.com/ipython/ipython / get_output_error_code

Function get_output_error_code

IPython/utils/_process_common.py:153–175  ·  view source on GitHub ↗

Return (standard output, standard error, return code) of executing cmd in a shell. Accepts the same arguments as os.system(). Parameters ---------- cmd : str or list A command to be executed in the system shell. Returns ------- stdout : str stderr : str

(cmd)

Source from the content-addressed store, hash-verified

151 return get_output_error_code(cmd)[:2]
152
153def get_output_error_code(cmd):
154 """Return (standard output, standard error, return code) of executing cmd
155 in a shell.
156
157 Accepts the same arguments as os.system().
158
159 Parameters
160 ----------
161 cmd : str or list
162 A command to be executed in the system shell.
163
164 Returns
165 -------
166 stdout : str
167 stderr : str
168 returncode: int
169 """
170
171 out_err, p = process_handler(cmd, lambda p: (p.communicate(), p))
172 if out_err is None:
173 return '', '', p.returncode
174 out, err = out_err
175 return py3compat.decode(out), py3compat.decode(err), p.returncode
176
177def arg_split(s, posix=False, strict=True):
178 """Split a command line's arguments in a shell-like manner.

Callers 4

help_output_testFunction · 0.90
help_all_output_testFunction · 0.90
getoutputerrorFunction · 0.85

Calls 1

process_handlerFunction · 0.85

Tested by 1