/* DF-2686 helper: report the child's precise exit fate (exit vs signal vs hang). */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#include <string.h>
int main(int argc, char **argv){
    pid_t p = fork();
    if (p == 0) { execv(argv[1], &argv[1]); _exit(127); }
    int st;
    waitpid(p, &st, 0);
    if (WIFEXITED(st))  printf("CHILD exited status=%d\n", WEXITSTATUS(st));
    if (WIFSIGNALED(st)) printf("CHILD killed by signal %d (%s) core=%d\n", WTERMSIG(st), strsignal(WTERMSIG(st)), WCOREDUMP(st));
    if (WIFSTOPPED(st)) printf("CHILD stopped %d\n", WSTOPSIG(st));
    fflush(stdout);
    return 0;
}
