summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-07-25 20:59:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-07-25 20:59:23 (GMT)
commita5194d806c46a71d523054db28f0b22e23284a3c (patch)
tree755a2cc2943bd67003fd3c932d9026e880d9bc62 /compat/mingw.c
parentfe9dc6b08c35a8808d24ad32ddac847bc3137a4a (diff)
parenteb7c78631445f35737d059bea23174d972cf7ca3 (diff)
downloadgit-a5194d806c46a71d523054db28f0b22e23284a3c.zip
git-a5194d806c46a71d523054db28f0b22e23284a3c.tar.gz
git-a5194d806c46a71d523054db28f0b22e23284a3c.tar.bz2
Merge branch 'js/mingw-spawn-with-spaces-in-path'
Window 7 update ;-) * js/mingw-spawn-with-spaces-in-path: mingw: support spawning programs containing spaces in their names
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index d991346..738f0a8 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1437,7 +1437,9 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
si.hStdOutput = winansi_get_osfhandle(fhout);
si.hStdError = winansi_get_osfhandle(fherr);
- if (xutftowcs_path(wcmd, cmd) < 0)
+ if (*argv && !strcmp(cmd, *argv))
+ wcmd[0] = L'\0';
+ else if (xutftowcs_path(wcmd, cmd) < 0)
return -1;
if (dir && xutftowcs_path(wdir, dir) < 0)
return -1;
@@ -1466,8 +1468,8 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
wenvblk = make_environment_block(deltaenv);
memset(&pi, 0, sizeof(pi));
- ret = CreateProcessW(wcmd, wargs, NULL, NULL, TRUE, flags,
- wenvblk, dir ? wdir : NULL, &si, &pi);
+ ret = CreateProcessW(*wcmd ? wcmd : NULL, wargs, NULL, NULL, TRUE,
+ flags, wenvblk, dir ? wdir : NULL, &si, &pi);
free(wenvblk);
free(wargs);