Browse Source

Allow quotes in editor command on Windows

This change allows setting the EDITOR env. variable to point to a
program location that contains quotes and spaces.

For example:

> set EDITOR="C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst -nosession
> repo upload

Change-Id: Ic95b00f7443982b1956a2992d0220e50b1cf6bbb
Renaud Paquay 9 năm trước cách đây
mục cha
commit
cd892a38a6
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      editor.py

+ 6 - 1
editor.py

@@ -83,7 +83,12 @@ least one of these before using this command.""", file=sys.stderr)
       os.close(fd)
       fd = None
 
-      if re.compile("^.*[$ \t'].*$").match(editor):
+      if platform_utils.isWindows():
+        # Split on spaces, respecting quoted strings
+        import shlex
+        args = shlex.split(editor)
+        shell = False
+      elif re.compile("^.*[$ \t'].*$").match(editor):
         args = [editor + ' "$@"', 'sh']
         shell = True
       else: