Skip to content

Commit 8c03a5d

Browse files
committed
Merge branch 'spawn-with-spaces'
This change lets us spawn .bat scripts whose paths contain spaces. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 717f660 + b0f8cbe commit 8c03a5d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compat/mingw.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,9 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
14881488
si.hStdError = winansi_get_osfhandle(fherr);
14891489

14901490
/* executables and the current directory don't support long paths */
1491-
if (xutftowcs_path(wcmd, cmd) < 0)
1491+
if (*argv && !strcmp(cmd, *argv))
1492+
wcmd[0] = L'\0';
1493+
else if (xutftowcs_path(wcmd, cmd) < 0)
14921494
return -1;
14931495
if (dir && xutftowcs_path(wdir, dir) < 0)
14941496
return -1;
@@ -1542,8 +1544,8 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
15421544
wenvblk = make_environment_block(deltaenv);
15431545

15441546
memset(&pi, 0, sizeof(pi));
1545-
ret = CreateProcessW(wcmd, wargs, NULL, NULL, TRUE, flags,
1546-
wenvblk, dir ? wdir : NULL, &si, &pi);
1547+
ret = CreateProcessW(*wcmd ? wcmd : NULL, wargs, NULL, NULL, TRUE,
1548+
flags, wenvblk, dir ? wdir : NULL, &si, &pi);
15471549

15481550
free(wenvblk);
15491551
free(wargs);

0 commit comments

Comments
 (0)