Skip to content

Commit 21f5232

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 e63e262 + a928ba1 commit 21f5232

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
@@ -1479,7 +1479,9 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
14791479
si.hStdError = winansi_get_osfhandle(fherr);
14801480

14811481
/* executables and the current directory don't support long paths */
1482-
if (xutftowcs_path(wcmd, cmd) < 0)
1482+
if (*argv && !strcmp(cmd, *argv))
1483+
wcmd[0] = L'\0';
1484+
else if (xutftowcs_path(wcmd, cmd) < 0)
14831485
return -1;
14841486
if (dir && xutftowcs_path(wdir, dir) < 0)
14851487
return -1;
@@ -1533,8 +1535,8 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
15331535
wenvblk = make_environment_block(deltaenv);
15341536

15351537
memset(&pi, 0, sizeof(pi));
1536-
ret = CreateProcessW(wcmd, wargs, NULL, NULL, TRUE, flags,
1537-
wenvblk, dir ? wdir : NULL, &si, &pi);
1538+
ret = CreateProcessW(*wcmd ? wcmd : NULL, wargs, NULL, NULL, TRUE,
1539+
flags, wenvblk, dir ? wdir : NULL, &si, &pi);
15381540

15391541
free(wenvblk);
15401542
free(wargs);

0 commit comments

Comments
 (0)