Skip to content

Commit 8bb5b6e

Browse files
dschonalla
authored andcommitted
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 bba44dc commit 8bb5b6e

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
@@ -1011,6 +1011,16 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
10111011
free(quoted);
10121012
}
10131013

1014+
if (getenv("GIT_STRACE_COMMANDS")) {
1015+
char **path = get_path_split();
1016+
cmd = path_lookup("strace.exe", path, 1);
1017+
if (!cmd)
1018+
return error("strace not found!");
1019+
if (xutftowcs_path(wcmd, cmd) < 0)
1020+
return -1;
1021+
strbuf_insert(&args, 0, "strace ", 7);
1022+
}
1023+
10141024
wargs = xmalloc((2 * args.len + 1) * sizeof(wchar_t));
10151025
xutftowcs(wargs, args.buf, 2 * args.len + 1);
10161026
strbuf_release(&args);

0 commit comments

Comments
 (0)