diff options
Diffstat (limited to 'common-main.c')
-rw-r--r-- | common-main.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/common-main.c b/common-main.c index 71e21dd20a..29fb7452f8 100644 --- a/common-main.c +++ b/common-main.c @@ -26,6 +26,7 @@ static void restore_sigpipe_to_default(void) int main(int argc, const char **argv) { int result; + struct strbuf tmp = STRBUF_INIT; trace2_initialize_clock(); @@ -49,9 +50,15 @@ int main(int argc, const char **argv) trace2_cmd_start(argv); trace2_collect_process_info(TRACE2_PROCESS_INFO_STARTUP); - result = cmd_main(argc, argv); + if (!strbuf_getcwd(&tmp)) + tmp_original_cwd = strbuf_detach(&tmp, NULL); - trace2_cmd_exit(result); + result = cmd_main(argc, argv); - return result; + /* + * We define exit() to call trace2_cmd_exit_fl() in + * git-compat-util.h. Whether we reach this or exit() + * elsewhere we'll always run our trace2 exit handler. + */ + exit(result); } |