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

Function getoutput

IPython/utils/_process_common.py:114–133  ·  view source on GitHub ↗

Run a command and return its stdout/stderr as a string. Parameters ---------- cmd : str or list A command to be executed in the system shell. Returns ------- output : str A string containing the combination of stdout and stderr from the subprocess, in whatev

(cmd)

Source from the content-addressed store, hash-verified

112
113
114def getoutput(cmd):
115 """Run a command and return its stdout/stderr as a string.
116
117 Parameters
118 ----------
119 cmd : str or list
120 A command to be executed in the system shell.
121
122 Returns
123 -------
124 output : str
125 A string containing the combination of stdout and stderr from the
126 subprocess, in whatever order the subprocess originally wrote to its
127 file descriptors (so the order of the information in this string is the
128 correct order as would be seen if running the command in a terminal).
129 """
130 out = process_handler(cmd, lambda p: p.communicate()[0], subprocess.STDOUT)
131 if out is None:
132 return ''
133 return py3compat.decode(out)
134
135
136def getoutputerror(cmd):

Callers

nothing calls this directly

Calls 1

process_handlerFunction · 0.85

Tested by

no test coverage detected