summaryrefslogtreecommitdiffstats
path: root/editor.py
diff options
context:
space:
mode:
Diffstat (limited to 'editor.py')
-rw-r--r--editor.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/editor.py b/editor.py
index 883a1a83..7980f2b4 100644
--- a/editor.py
+++ b/editor.py
@@ -21,6 +21,7 @@ import subprocess
21import tempfile 21import tempfile
22 22
23from error import EditorError 23from error import EditorError
24import platform_utils
24 25
25class Editor(object): 26class Editor(object):
26 """Manages the user's preferred text editor.""" 27 """Manages the user's preferred text editor."""
@@ -82,7 +83,12 @@ least one of these before using this command.""", file=sys.stderr)
82 os.close(fd) 83 os.close(fd)
83 fd = None 84 fd = None
84 85
85 if re.compile("^.*[$ \t'].*$").match(editor): 86 if platform_utils.isWindows():
87 # Split on spaces, respecting quoted strings
88 import shlex
89 args = shlex.split(editor)
90 shell = False
91 elif re.compile("^.*[$ \t'].*$").match(editor):
86 args = [editor + ' "$@"', 'sh'] 92 args = [editor + ' "$@"', 'sh']
87 shell = True 93 shell = True
88 else: 94 else:
@@ -107,4 +113,4 @@ least one of these before using this command.""", file=sys.stderr)
107 finally: 113 finally:
108 if fd: 114 if fd:
109 os.close(fd) 115 os.close(fd)
110 os.remove(path) 116 platform_utils.remove(path)