Commit 9ae78267 by Matthias Putz

Portable: fix GIT_EDITOR call with spaces on Windows

parent 3bebba1b
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
from __future__ import print_function from __future__ import print_function
import os import os
import portable
import re import re
import sys import sys
import subprocess import subprocess
...@@ -83,8 +84,9 @@ least one of these before using this command.""", file=sys.stderr) ...@@ -83,8 +84,9 @@ least one of these before using this command.""", file=sys.stderr)
fd = None fd = None
if re.compile("^.*[$ \t'].*$").match(editor): if re.compile("^.*[$ \t'].*$").match(editor):
args = [editor + ' "$@"', 'sh'] # args = [editor + ' "$@"', 'sh']
shell = True # shell = True
(args, shell) = portable.prepare_editor_args(editor)
else: else:
args = [editor] args = [editor]
shell = False shell = False
......
...@@ -274,3 +274,14 @@ def WaitForProcess(): ...@@ -274,3 +274,14 @@ def WaitForProcess():
if child_process: if child_process:
child_process.stdin.close() child_process.stdin.close()
child_process.wait() 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