We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fe9dc6b + eb7c786 commit a5194d8Copy full SHA for a5194d8
compat/mingw.c
@@ -1437,7 +1437,9 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
1437
si.hStdOutput = winansi_get_osfhandle(fhout);
1438
si.hStdError = winansi_get_osfhandle(fherr);
1439
1440
- if (xutftowcs_path(wcmd, cmd) < 0)
+ if (*argv && !strcmp(cmd, *argv))
1441
+ wcmd[0] = L'\0';
1442
+ else if (xutftowcs_path(wcmd, cmd) < 0)
1443
return -1;
1444
if (dir && xutftowcs_path(wdir, dir) < 0)
1445
@@ -1466,8 +1468,8 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
1466
1468
wenvblk = make_environment_block(deltaenv);
1467
1469
1470
memset(&pi, 0, sizeof(pi));
- ret = CreateProcessW(wcmd, wargs, NULL, NULL, TRUE, flags,
- wenvblk, dir ? wdir : NULL, &si, &pi);
1471
+ ret = CreateProcessW(*wcmd ? wcmd : NULL, wargs, NULL, NULL, TRUE,
1472
+ flags, wenvblk, dir ? wdir : NULL, &si, &pi);
1473
1474
free(wenvblk);
1475
free(wargs);
t/t0061-run-command.sh
@@ -210,4 +210,10 @@ test_expect_success MINGW 'verify curlies are quoted properly' '
210
test_cmp expect actual
211
'
212
213
+test_expect_success MINGW 'can spawn with argv[0] containing spaces' '
214
+ cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" ./ &&
215
+ test_must_fail "$PWD/test-fake-ssh$X" 2>err &&
216
+ grep TRASH_DIRECTORY err
217
+'
218
+
219
test_done
0 commit comments