Merge branch 'spawn-with-spaces'

This topic branch conflicts with the next change that will change the
way we call `CreateProcessW()`. So let's merge it early, to avoid merge
conflicts during a merge (because we would have to resolve this with
every single merging-rebase).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2018-10-12 16:47:46 +02:00
Родитель 60af6519a4 34b762f8b8
Коммит 57d1990234
2 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -1465,7 +1465,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;
@ -1494,8 +1496,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);

Просмотреть файл

@ -210,4 +210,10 @@ test_expect_success MINGW 'verify curlies are quoted properly' '
test_cmp expect actual
'
test_expect_success MINGW 'can spawn with argv[0] containing spaces' '
cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" ./ &&
test_must_fail "$PWD/test-fake-ssh$X" 2>err &&
grep TRASH_DIRECTORY err
'
test_done