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 |
@@ -112,11 +112,9 b' class TerminalInteractiveShell(InteractiveShell):' | |||||
112 | config=config, profile_dir=profile_dir, user_ns=user_ns, |
|
112 | config=config, profile_dir=profile_dir, user_ns=user_ns, | |
113 | user_global_ns=user_global_ns, custom_exceptions=custom_exceptions |
|
113 | user_global_ns=user_global_ns, custom_exceptions=custom_exceptions | |
114 | ) |
|
114 | ) | |
115 |
# use os.system instead of utils.process.system by default, |
|
115 | # use os.system instead of utils.process.system by default, | |
116 | if os.name == 'nt': |
|
116 | # because piped system doesn't make sense in the Terminal: | |
117 |
|
|
117 | self.system = self.system_raw | |
118 | else: |
|
|||
119 | self.system = self.system_raw |
|
|||
120 |
|
118 | |||
121 | self.init_term_title() |
|
119 | self.init_term_title() | |
122 | self.init_usage(usage) |
|
120 | self.init_usage(usage) |
General Comments 0
You need to be logged in to leave comments.
Login now