Skip to content

Commit 608a1b7

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 5c5674d + a7f8bad commit 608a1b7

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

12701270
/* executables and the current directory don't support long paths */
1271-
if (xutftowcs_path(wcmd, cmd) < 0)
1271+
if (*argv && !strcmp(cmd, *argv))
1272+
wcmd[0] = L'\0';
1273+
else if (xutftowcs_path(wcmd, cmd) < 0)
12721274
return -1;
12731275
if (dir && xutftowcs_path(wdir, dir) < 0)
12741276
return -1;
@@ -1307,8 +1309,8 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
13071309
wenvblk = make_environment_block(deltaenv);
13081310

13091311
memset(&pi, 0, sizeof(pi));
1310-
ret = CreateProcessW(wcmd, wargs, NULL, NULL, TRUE, flags,
1311-
wenvblk, dir ? wdir : NULL, &si, &pi);
1312+
ret = CreateProcessW(*wcmd ? wcmd : NULL, wargs, NULL, NULL, TRUE,
1313+
flags, wenvblk, dir ? wdir : NULL, &si, &pi);
13121314

13131315
free(wenvblk);
13141316
free(wargs);

0 commit comments

Comments
 (0)