diff options
Diffstat (limited to 'lib/supervisor.c')
-rw-r--r-- | lib/supervisor.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/supervisor.c b/lib/supervisor.c index ca472d1..f1d95cc 100644 --- a/lib/supervisor.c +++ b/lib/supervisor.c @@ -67,6 +67,12 @@ static void term_handler(int sig) exit(EXIT_FAILURE); } +static void child_handler(int sig) +{ + /* If the child exits early we treat it as a test failure: */ + exit(EXIT_FAILURE); +} + static void alarm_handler(int sig) { char *msg = mprintf("========= FAILED TIMEOUT %s in %lus\n", @@ -310,6 +316,10 @@ int main(int argc, char *argv[]) ssize_t len; char *line = NULL; + struct sigaction child_action = { .sa_handler = child_handler }; + if (sigaction(SIGCHLD, &child_action, NULL)) + die("sigaction error: %m"); + struct sigaction alarm_action = { .sa_handler = alarm_handler }; if (sigaction(SIGALRM, &alarm_action, NULL)) die("sigaction error: %m"); |