On Thu, Mar 03 2022, Junio C Hamano wrote: > Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > >> Yes, it returns the correct status code, but that doesn't help with >> (pseudo)code like: >> >> if (run_command("foo")) /* exits with e.g. 123 */ >> die("oh no, foo failed"); /* exits with 128 */ >> >> I should have said "code using run-command.c does not do that...", >> sorry. > > Yeah, but even if callers of run_command() can tell "foo" > segfaulted, I do not think it is sensible to exit as if we > segfaulted (or, we _could_ actually die by segfaulting ourselves, > which is worse). I should have made it clear that I'm thinking about this as a test-only mode, so hidden behind some GIT_TEST_* variable, i.e. as a means to an end in getting the test suite to spot the failure in the sub-process. It's not the only way to do it, but it's the simplest and most reliable given how our tests are run.