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

Function system

IPython/utils/_process_win32.py:123–145  ·  view source on GitHub ↗

Win32 version of os.system() that works with network shares. Note that this implementation returns None, as meant for use in IPython. Parameters ---------- cmd : str or list A command to be executed in the system shell. Returns ------- int : child process' exit c

(cmd)

Source from the content-addressed store, hash-verified

121
122
123def system(cmd):
124 """Win32 version of os.system() that works with network shares.
125
126 Note that this implementation returns None, as meant for use in IPython.
127
128 Parameters
129 ----------
130 cmd : str or list
131 A command to be executed in the system shell.
132
133 Returns
134 -------
135 int : child process' exit code.
136 """
137 # The controller provides interactivity with both
138 # stdin and stdout
139 #import _process_win32_controller
140 #_process_win32_controller.system(cmd)
141
142 with AvoidUNCPath() as path:
143 if path is not None:
144 cmd = '"pushd %s &&"%s' % (path, cmd)
145 return process_handler(cmd, _system_body)
146
147def getoutput(cmd):
148 """Return standard output of executing cmd in a shell.

Callers

nothing calls this directly

Calls 2

process_handlerFunction · 0.85
AvoidUNCPathClass · 0.70

Tested by

no test coverage detected