Skip to content

Commit f17ce69

Browse files
author
Git for Windows Build Agent
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 0cc88f2 + a9e7a3d commit f17ce69

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compat/mingw.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,9 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
12851285
si.hStdError = winansi_get_osfhandle(fherr);
12861286

12871287
/* executables and the current directory don't support long paths */
1288-
if (xutftowcs_path(wcmd, cmd) < 0)
1288+
if (*argv && !strcmp(cmd, *argv))
1289+
wcmd[0] = L'\0';
1290+
else if (xutftowcs_path(wcmd, cmd) < 0)
12891291
return -1;
12901292
if (dir && xutftowcs_path(wdir, dir) < 0)
12911293
return -1;
@@ -1324,8 +1326,8 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
13241326
wenvblk = make_environment_block(deltaenv);
13251327

13261328
memset(&pi, 0, sizeof(pi));
1327-
ret = CreateProcessW(wcmd, wargs, NULL, NULL, TRUE, flags,
1328-
wenvblk, dir ? wdir : NULL, &si, &pi);
1329+
ret = CreateProcessW(*wcmd ? wcmd : NULL, wargs, NULL, NULL, TRUE,
1330+
flags, wenvblk, dir ? wdir : NULL, &si, &pi);
13291331

13301332
free(wenvblk);
13311333
free(wargs);

0 commit comments

Comments
 (0)