diff options
| author | Renaud Paquay <rpaquay@google.com> | 2016-11-03 15:59:05 -0700 |
|---|---|---|
| committer | Renaud Paquay <rpaquay@google.com> | 2017-08-31 13:49:49 -0700 |
| commit | cd892a38a61e2cb5975189a8f6e61fe1cd72d2c1 (patch) | |
| tree | 893d07c27770c4376f9e4a78395fc944761dd032 /editor.py | |
| parent | 010fed771183c23c0e7d04a4e7292782f68de9db (diff) | |
| download | git-repo-cd892a38a61e2cb5975189a8f6e61fe1cd72d2c1.tar.gz | |
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
Diffstat (limited to 'editor.py')
| -rw-r--r-- | editor.py | 7 |
1 files changed, 6 insertions, 1 deletions
| @@ -83,7 +83,12 @@ least one of these before using this command.""", file=sys.stderr) | |||
| 83 | os.close(fd) | 83 | os.close(fd) |
| 84 | fd = None | 84 | fd = None |
| 85 | 85 | ||
| 86 | 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): | ||
| 87 | args = [editor + ' "$@"', 'sh'] | 92 | args = [editor + ' "$@"', 'sh'] |
| 88 | shell = True | 93 | shell = True |
| 89 | else: | 94 | else: |
