Show More
@@ -30,7 +30,7 b' from IPython.core.magic import (' | |||
|
30 | 30 | from IPython.lib.backgroundjobs import BackgroundJobManager |
|
31 | 31 | from IPython.testing.skipdoctest import skip_doctest |
|
32 | 32 | from IPython.utils import py3compat |
|
33 |
from IPython.utils.process import |
|
|
33 | from IPython.utils.process import arg_split | |
|
34 | 34 | from IPython.utils.traitlets import List, Dict |
|
35 | 35 | |
|
36 | 36 | #----------------------------------------------------------------------------- |
@@ -90,36 +90,23 b' class ScriptMagics(Magics, Configurable):' | |||
|
90 | 90 | """, |
|
91 | 91 | ) |
|
92 | 92 | def _script_magics_default(self): |
|
93 |
"""default to a common list of programs |
|
|
93 | """default to a common list of programs""" | |
|
94 | 94 | |
|
95 |
defaults = [ |
|
|
96 | to_try = [] | |
|
97 | if os.name == 'nt': | |
|
98 | defaults.append('cmd') | |
|
99 | to_try.append('powershell') | |
|
100 | to_try.extend([ | |
|
95 | defaults = [ | |
|
101 | 96 | 'sh', |
|
102 | 97 | 'bash', |
|
103 | 98 | 'perl', |
|
104 | 99 | 'ruby', |
|
100 | 'python', | |
|
105 | 101 | 'python3', |
|
106 | 102 | 'pypy', |
|
103 | ] | |
|
104 | if os.name == 'nt': | |
|
105 | defaults.extend([ | |
|
106 | 'cmd', | |
|
107 | 'powershell', | |
|
107 | 108 | ]) |
|
108 | 109 | |
|
109 | for cmd in to_try: | |
|
110 | if cmd in self.script_paths: | |
|
111 | defaults.append(cmd) | |
|
112 | else: | |
|
113 | try: | |
|
114 | find_cmd(cmd) | |
|
115 | except FindCmdError: | |
|
116 | # command not found, ignore it | |
|
117 | pass | |
|
118 | except ImportError: | |
|
119 | # Windows without pywin32, find_cmd doesn't work | |
|
120 | pass | |
|
121 | else: | |
|
122 | defaults.append(cmd) | |
|
123 | 110 | return defaults |
|
124 | 111 | |
|
125 | 112 | script_paths = Dict(config=True, |
General Comments 0
You need to be logged in to leave comments.
Login now