Re: [PATCH 5/5] launch_editor: propagate SIGINT from editor to git
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Nov 11, 2012, 19:48 UTC
- Message-ID
- <50A00116.8060604@kdbg.org>
- In-Reply-To
- <20121111165706.GE19850@sigill.intra.peff.net>
Am 11.11.2012 17:57, schrieb Jeff King:
Show 6 quoted lines
> @@ -51,6 +51,8 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en > sigchain_push(SIGINT, SIG_IGN); > ret = finish_command(&p); > sigchain_pop(SIGINT); > + if (WIFSIGNALED(ret) && WTERMSIG(ret) == SIGINT) > + raise(SIGINT);
The return value of finish_command() is already a digested version of waitpid's status value. According to Documentation/technical/api-run-command.txt:
. If the program terminated due to a signal, then the return value is the signal number - 128, ...
the correct condition would be
if (ret == SIGINT - 128)
-- Hannes