diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-01-10 19:52:53 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-10 19:52:53 (GMT) |
commit | 4b51386bbfc5d26e552c3c4be135e31cd2f64b44 (patch) | |
tree | 5bff7a8a4dee06d92dca0a89976248dc7e571918 /run-command.c | |
parent | bc61dbac770923a96e2007c3de4027c5d11c6d41 (diff) | |
parent | f5c39c3268107e1f3def70709d509fd24282832c (diff) | |
download | git-4b51386bbfc5d26e552c3c4be135e31cd2f64b44.zip git-4b51386bbfc5d26e552c3c4be135e31cd2f64b44.tar.gz git-4b51386bbfc5d26e552c3c4be135e31cd2f64b44.tar.bz2 |
Merge branch 'ab/usage-die-message'
Code clean-up to hide vreportf() from public API.
* ab/usage-die-message:
config API: use get_error_routine(), not vreportf()
usage.c + gc: add and use a die_message_errno()
gc: return from cmd_gc(), don't call exit()
usage.c API users: use die_message() for error() + exit 128
usage.c API users: use die_message() for "fatal :" + exit 128
usage.c: add a die_message() routine
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/run-command.c b/run-command.c index 3ea2c2f..69dde42 100644 --- a/run-command.c +++ b/run-command.c @@ -340,15 +340,6 @@ static void child_close_pair(int fd[2]) child_close(fd[1]); } -/* - * parent will make it look like the child spewed a fatal error and died - * this is needed to prevent changes to t0061. - */ -static void fake_fatal(const char *err, va_list params) -{ - vreportf("fatal: ", err, params); -} - static void child_error_fn(const char *err, va_list params) { const char msg[] = "error() should not be called in child\n"; @@ -372,9 +363,10 @@ static void NORETURN child_die_fn(const char *err, va_list params) static void child_err_spew(struct child_process *cmd, struct child_err *cerr) { static void (*old_errfn)(const char *err, va_list params); + report_fn die_message_routine = get_die_message_routine(); old_errfn = get_error_routine(); - set_error_routine(fake_fatal); + set_error_routine(die_message_routine); errno = cerr->syserr; switch (cerr->err) { @@ -1072,7 +1064,9 @@ static void *run_thread(void *data) static NORETURN void die_async(const char *err, va_list params) { - vreportf("fatal: ", err, params); + report_fn die_message_fn = get_die_message_routine(); + + die_message_fn(err, params); if (in_async()) { struct async *async = pthread_getspecific(async_key); |