6 #include <process/process.h>
7 #include <waiter/waiter.h>
8 #include <talloc/talloc.h>
10 static int do_child(void)
16 static int exit_status;
18 static void exit_cb(struct process *process)
21 exit_status = process->exit_status;
24 int main(int argc, char **argv)
26 struct waitset *waitset;
27 struct process *process;
28 const char *child_argv[3];
31 if (argc == 2 && !strcmp(argv[1], "child"))
34 ctx = talloc_new(NULL);
36 waitset = waitset_create(ctx);
38 process_init(ctx, waitset, false);
40 child_argv[0] = argv[0];
41 child_argv[1] = "child";
44 process = process_create(ctx);
45 process->path = child_argv[0];
46 process->argv = child_argv;
47 process->exit_cb = exit_cb;
51 process_run_async(process);
60 assert(WIFEXITED(exit_status));
61 assert(WEXITSTATUS(exit_status) == 42);