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

Function getoutput

IPython/utils/_process_win32.py:147–169  ·  view source on GitHub ↗

Return standard output 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

(cmd)

Source from the content-addressed store, hash-verified

145 return process_handler(cmd, _system_body)
146
147def getoutput(cmd):
148 """Return standard output of executing cmd in a shell.
149
150 Accepts the same arguments as os.system().
151
152 Parameters
153 ----------
154 cmd : str or list
155 A command to be executed in the system shell.
156
157 Returns
158 -------
159 stdout : str
160 """
161
162 with AvoidUNCPath() as path:
163 if path is not None:
164 cmd = '"pushd %s &&"%s' % (path, cmd)
165 out = process_handler(cmd, lambda p: p.communicate()[0], STDOUT)
166
167 if out is None:
168 out = b''
169 return py3compat.decode(out)
170
171try:
172 CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW

Callers

nothing calls this directly

Calls 2

process_handlerFunction · 0.85
AvoidUNCPathClass · 0.70

Tested by

no test coverage detected