run_hook: why special check for uncaught signal?
Function run_hook (in run-command.c) has this check:
ret = finish_command(&hook);
if (ret == -ERR_RUN_COMMAND_WAITPID_SIGNAL)
warning("%s exited due to uncaught signal", argv[0]);
return ret;The lines were moved to this location by ae98a008 (Move run_hook() from builtin-commit.c into run-command.c (libgit), 2009-01-16). Before this commit, the check existed in builtin-gc.c. It was introduced by bde30540 (git-gc --auto: add pre-auto-gc hook, 2008-04-09).
Why is this check necessary?
I'm asking because I'm working on a modification that would remove ERR_RUN_COMMAND_WAITPID_SIGNAL.
-- Hannes
Quoted 7 lines · Johannes Sixt
Function
run_hook(inrun-command.c) has this check:ret = finish_command(&hook); if (ret == -ERR_RUN_COMMAND_WAITPID_SIGNAL) warning("%s exited due to uncaught signal", argv[0]); return ret;
Quoted 6 lines
The lines were moved to this location by
ae98a008(Moverun_hook()frombuiltin-commit.cintorun-command.c(libgit), 2009-01-16). Before this commit, the check existed inbuiltin-gc.c. It was introduced bybde30540(git-gc --auto: add pre-auto-gc hook, 2008-04-09).Why is this check necessary?
I do not really remember, but I think I wanted to give some error messages for each return code, and somehow left out ERR_RUN_COMMAND_WAITPID, ERR_RUN_COMMAND_WAITPID_WRONG_PID and ERR_RUN_COMMAND_WAITPID_NOEXIT.
Quoted 2 lines
I'm asking because I'm working on a modification that would remove
ERR_RUN_COMMAND_WAITPID_SIGNAL.
That's fine, I think ideally run_hook() should call warning() for each case which may be returned. Such functionality is already available in builtin-receive-pack.c::hook_status() and unpack(), probably it would make sense to introduce some run_command_strerror() to avoid code duplication.
Sadly I don't have time to implement this in the near future.