mingw: detect when MSYS2's sh is to be spawned more robustly
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Johannes Schindelin committed
Sep 19, 2019 at 17:05 UTC
e2ba3d6f6d1c2b0e7e501ae01a0e839a6f537188
1 file changed
+14
-1
compat/mingw.c
+14
-1
@@ -1391,7 +1391,10 @@ static inline int match_last_path_component(const char *path, size_t *len,
1391
1392
static int is_msys2_sh(const char *cmd)
1393
{
1394
- if (cmd && !strcmp(cmd, "sh")) {
1394
+ if (!cmd)
1395
+ return 0;
1396
+
1397
+ if (!strcmp(cmd, "sh")) {
1398
static int ret = -1;
1399
char *p;
1400
@@ -1411,6 +1414,16 @@ static int is_msys2_sh(const char *cmd)
1414
}
1415
return ret;
1416
}
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
+
1427
return 0;
1428
}
1429