MCPcopy Index your code
hub / github.com/ipython/ipython / getoutput

Function getoutput

IPython/utils/_process_win32.py:142–164  ·  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: str)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

process_handlerFunction · 0.85
AvoidUNCPathClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…