Skip to content

Commit 900c48e

Browse files
committed
Help debugging with MSys2 by optionally executing bash with strace
MSys2's strace facility is very useful for debugging... With this patch, the bash will be executed through strace if the environment variable GIT_STRACE_COMMANDS is set, which comes in real handy when investigating issues in the test suite. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 2c04701 commit 900c48e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compat/mingw.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,16 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
11371137
free(quoted);
11381138
}
11391139

1140+
if (getenv("GIT_STRACE_COMMANDS")) {
1141+
char **path = get_path_split();
1142+
cmd = path_lookup("strace.exe", path, 1);
1143+
if (!cmd)
1144+
return error("strace not found!");
1145+
if (xutftowcs_path(wcmd, cmd) < 0)
1146+
return -1;
1147+
strbuf_insert(&args, 0, "strace ", 7);
1148+
}
1149+
11401150
ALLOC_ARRAY(wargs, st_add(st_mult(2, args.len), 1));
11411151
xutftowcs(wargs, args.buf, 2 * args.len + 1);
11421152
strbuf_release(&args);

0 commit comments

Comments
 (0)