Show More
@@ -2075,10 +2075,21 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
2075 | cmd : str |
|
2075 | cmd : str | |
2076 | Command to execute. |
|
2076 | Command to execute. | |
2077 | """ |
|
2077 | """ | |
|
2078 | cmd = self.var_expand(cmd, depth=2) | |||
|
2079 | # protect os.system from UNC paths on Windows, which it can't handle: | |||
|
2080 | if sys.platform == 'win32': | |||
|
2081 | from IPython.utils._process_win32 import AvoidUNCPath | |||
|
2082 | with AvoidUNCPath() as path: | |||
|
2083 | if path is not None: | |||
|
2084 | cmd = '"pushd %s &&"%s' % (path, cmd) | |||
|
2085 | ec = os.system(cmd) | |||
|
2086 | else: | |||
|
2087 | ec = os.system(cmd) | |||
|
2088 | ||||
2078 | # We explicitly do NOT return the subprocess status code, because |
|
2089 | # We explicitly do NOT return the subprocess status code, because | |
2079 | # a non-None value would trigger :func:`sys.displayhook` calls. |
|
2090 | # a non-None value would trigger :func:`sys.displayhook` calls. | |
2080 | # Instead, we store the exit_code in user_ns. |
|
2091 | # Instead, we store the exit_code in user_ns. | |
2081 |
self.user_ns['_exit_code'] = |
|
2092 | self.user_ns['_exit_code'] = ec | |
2082 |
|
2093 | |||
2083 | # use piped system by default, because it is better behaved |
|
2094 | # use piped system by default, because it is better behaved | |
2084 | system = system_piped |
|
2095 | system = system_piped |
General Comments 0
You need to be logged in to leave comments.
Login now