##// END OF EJS Templates
use shlex.split on editor hooks on Windows...
Min RK -
Show More
@@ -8,6 +8,7 b' from __future__ import print_function'
8
8
9 import os
9 import os
10 import pipes
10 import pipes
11 import shlex
11 import subprocess
12 import subprocess
12
13
13 from IPython import get_ipython
14 from IPython import get_ipython
@@ -15,7 +16,7 b' from IPython.core.error import TryNext'
15 from IPython.utils import py3compat
16 from IPython.utils import py3compat
16
17
17
18
18 def install_editor(template, wait=False):
19 def install_editor(template_list, wait=False):
19 """Installs the editor that is called by IPython for the %edit magic.
20 """Installs the editor that is called by IPython for the %edit magic.
20
21
21 This overrides the default editor, which is generally set by your EDITOR
22 This overrides the default editor, which is generally set by your EDITOR
@@ -48,6 +49,9 b' def install_editor(template, wait=False):'
48 line = 0
49 line = 0
49 cmd = template.format(filename=pipes.quote(filename), line=line)
50 cmd = template.format(filename=pipes.quote(filename), line=line)
50 print(">", cmd)
51 print(">", cmd)
52 # pipes.quote doesn't work right on Windows, but it does after splitting
53 if sys.platform.startswith('win'):
54 cmd = shlex.split(cmd)
51 proc = subprocess.Popen(cmd, shell=True)
55 proc = subprocess.Popen(cmd, shell=True)
52 if wait and proc.wait() != 0:
56 if wait and proc.wait() != 0:
53 raise TryNext()
57 raise TryNext()
General Comments 0
You need to be logged in to leave comments. Login now