diff options
Diffstat (limited to 'editor.py')
-rw-r--r-- | editor.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -21,6 +21,7 @@ import subprocess | |||
21 | import tempfile | 21 | import tempfile |
22 | 22 | ||
23 | from error import EditorError | 23 | from error import EditorError |
24 | import platform_utils | ||
24 | 25 | ||
25 | class Editor(object): | 26 | class 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) |