Skip to content

Commit

Permalink
Display signal exit condition of child test process
Browse files Browse the repository at this point in the history
If a child gets killed due a signal, we would basically be left wondering why as
there was nothing printed out except "failed". This follows the same wording as
init.c.
  • Loading branch information
haesbaert committed Nov 12, 2024
1 parent 137f95d commit 36c493f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ main(int argc, char *argv[])
if (WIFEXITED(status))
printf("%s exited with %d\n", argv[0], WEXITSTATUS(status));
else if (WIFSIGNALED(status))
printf("%s exited with signal %d (SIG%s)\n", argv[0],
WTERMSIG(status), sigabbrev_np(WTERMSIG(status)));
printf("%s exited with signal %d (%s)\n", argv[0],
WTERMSIG(status), strsignal(WTERMSIG(status)));
else if (WCOREDUMP(status))
printf("%s core dumped\n", argv[0]);
else
Expand Down
5 changes: 5 additions & 0 deletions quark-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ run_test(const struct test *t, struct quark_queue_attr *qa)
color(x);
}
fflush(stdout);
if (WIFSIGNALED(status))
fprintf(stderr, "exited with signal %d (%s)\n",
WTERMSIG(status), strsignal(WTERMSIG(status)));
else if (WCOREDUMP(status))
fprintf(stderr, "core dumped\n");

/*
* Children exited, close the stream and print it out.
Expand Down

0 comments on commit 36c493f

Please sign in to comment.