mingw: correct exit-code for SIGALRM's SIG_DFL

Make sure SIG_DFL for SIGALRM exits with 128 + SIGALRM so other processes can diagnose why it exits. While we're at it, make sure we only write to stderr if it's a terminal, and change the output to match that of Linux. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Erik Faye-Lund committed Dec 4, 2012 at 09:10 UTC f4f549892ac686a9adcf3cb72bee1a11c0566c88
1 file changed +5 -2
compat/mingw.c
+5 -2
@@ -1560,8 +1560,11 @@ static sig_handler_t timer_fn = SIG_DFL;
1560 static unsigned __stdcall ticktack(void *dummy)
1561 {
1562 while (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {
1563 - if (timer_fn == SIG_DFL)
1564 - die("Alarm");
1563 + if (timer_fn == SIG_DFL) {
1564 + if (isatty(STDERR_FILENO))
1565 + fputs("Alarm clock\n", stderr);
1566 + exit(128 + SIGALRM);
1567 + }
1568 if (timer_fn != SIG_IGN)
1569 timer_fn(SIGALRM);
1570 if (one_shot)