Skip to content

Commit

Permalink
Add job and set pgid
Browse files Browse the repository at this point in the history
  • Loading branch information
thundergolfer committed Jan 10, 2024
1 parent 1523116 commit 1f0cd9e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions books/computer_systems_app/labs/shell/tsh.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ void eval(char *cmdline)
exit(0); // TODO: dont always exit 0
} else {
debug("after fork: parent waiting for child");
if (setpgid(pid, pid)) { // give unique proc group ID
unix_error("failed to set proc group ID");
}
addjob(jobs, pid, FG, cmdline);
waitfg(pid);
}
return;
Expand Down

0 comments on commit 1f0cd9e

Please sign in to comment.