Commit 9ae78267 by Matthias Putz

Portable: fix GIT_EDITOR call with spaces on Windows

parent 3bebba1b
......@@ -15,6 +15,7 @@
from __future__ import print_function
import os
import portable
import re
import sys
import subprocess
......@@ -83,8 +84,9 @@ least one of these before using this command.""", file=sys.stderr)
fd = None
if re.compile("^.*[$ \t'].*$").match(editor):
args = [editor + ' "$@"', 'sh']
shell = True
# args = [editor + ' "$@"', 'sh']
# shell = True
(args, shell) = portable.prepare_editor_args(editor)
else:
args = [editor]
shell = False
......
......@@ -274,3 +274,14 @@ def WaitForProcess():
if child_process:
child_process.stdin.close()
child_process.wait()
def prepare_editor_args(editor):
if isUnix():
args = [editor + ' "$@"', 'sh']
shell = True
else:
editor = re.sub('["\']', '', editor)
args = editor.rsplit()
shell = False
return (args, shell)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment