Show More
@@ -2218,7 +2218,8 b' class InteractiveShell(SingletonConfigurable):' | |||||
2218 | self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1)) |
|
2218 | self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1)) | |
2219 |
|
2219 | |||
2220 | def system_raw(self, cmd): |
|
2220 | def system_raw(self, cmd): | |
2221 | """Call the given cmd in a subprocess using os.system |
|
2221 | """Call the given cmd in a subprocess using os.system on Windows or | |
|
2222 | subprocess.call using the system shell on other platforms. | |||
2222 |
|
2223 | |||
2223 | Parameters |
|
2224 | Parameters | |
2224 | ---------- |
|
2225 | ---------- | |
@@ -2236,11 +2237,12 b' class InteractiveShell(SingletonConfigurable):' | |||||
2236 | ec = os.system(cmd) |
|
2237 | ec = os.system(cmd) | |
2237 | else: |
|
2238 | else: | |
2238 | cmd = py3compat.unicode_to_str(cmd) |
|
2239 | cmd = py3compat.unicode_to_str(cmd) | |
2239 | ec = subprocess.call(cmd, shell=True, executable=os.environ.get('SHELL')) |
|
2240 | # Call the cmd using the OS shell, instead of the default /bin/sh, if set. | |
2240 | # The high byte is the exit code, the low byte is a signal number |
|
2241 | ec = subprocess.call(cmd, shell=True, executable=os.environ.get('SHELL', None)) | |
2241 | # that we discard for now. See the docs for os.wait() |
|
2242 | # Returns either the exit code or minus the value of the signal number. | |
2242 | if ec > 255: |
|
2243 | # See the docs for subprocess.Popen.returncode . | |
2243 |
|
|
2244 | if ec < 0: | |
|
2245 | ec = -ec | |||
2244 |
|
2246 | |||
2245 | # We explicitly do NOT return the subprocess status code, because |
|
2247 | # We explicitly do NOT return the subprocess status code, because | |
2246 | # a non-None value would trigger :func:`sys.displayhook` calls. |
|
2248 | # a non-None value would trigger :func:`sys.displayhook` calls. |
General Comments 0
You need to be logged in to leave comments.
Login now