1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Run time(1) children in their own process group.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-01-16 01:15:49 +01:00
parent ebb75f656c
commit f384fcdff1

View file

@ -40,13 +40,18 @@ int main(int argc, char* argv[])
error(1, errno, "fork");
if ( !child_pid )
{
setpgid(child_pid, child_pid);
tcsetpgrp(0, child_pid);
if ( argc <= 1 )
exit(0);
execvp(argv[1], argv+1);
error(127, errno, "%s", argv[1]);
}
setpgid(child_pid, child_pid);
tcsetpgrp(0, child_pid);
int exit_status = 0;
waitpid(child_pid, &exit_status, 0);
tcsetpgrp(0, getpgid(0));
struct timespec end_time;
clock_gettime(CLOCK_MONOTONIC, &end_time);