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 <johannes.schindelin@gmx.de>
This commit is contained in:
1 parent
4d12c24a9e
commit
1faf08e851
1 file changed
+10
@@ -1064,6 +1064,16 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
|
||||
free(quoted);
|
||||
}
|
||||
|
||||
if (getenv("GIT_STRACE_COMMANDS")) {
|
||||
char **path = get_path_split();
|
||||
cmd = path_lookup("strace.exe", path, 1);
|
||||
if (!cmd)
|
||||
return error("strace not found!");
|
||||
if (xutftowcs_path(wcmd, cmd) < 0)
|
||||
return -1;
|
||||
strbuf_insert(&args, 0, "strace ", 7);
|
||||
}
|
||||
|
||||
wargs = xmalloc((2 * args.len + 1) * sizeof(wchar_t));
|
||||
xutftowcs(wargs, args.buf, 2 * args.len + 1);
|
||||
strbuf_release(&args);
|
||||
|
||||
Reference in new issue
Block a user