Skip to content

Commit e2ba3d6

Browse files
committed
mingw: detect when MSYS2's sh is to be spawned more robustly
Signed-off-by: Johannes Schindelin <[email protected]>
1 parent d9061ed commit e2ba3d6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

compat/mingw.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,10 @@ static inline int match_last_path_component(const char *path, size_t *len,
13911391

13921392
static int is_msys2_sh(const char *cmd)
13931393
{
1394-
if (cmd && !strcmp(cmd, "sh")) {
1394+
if (!cmd)
1395+
return 0;
1396+
1397+
if (!strcmp(cmd, "sh")) {
13951398
static int ret = -1;
13961399
char *p;
13971400

@@ -1411,6 +1414,16 @@ static int is_msys2_sh(const char *cmd)
14111414
}
14121415
return ret;
14131416
}
1417+
1418+
if (ends_with(cmd, "\\sh.exe")) {
1419+
static char *sh;
1420+
1421+
if (!sh)
1422+
sh = path_lookup("sh", 0);
1423+
1424+
return !fspathcmp(cmd, sh);
1425+
}
1426+
14141427
return 0;
14151428
}
14161429

0 commit comments

Comments
 (0)