diff options
author | Franciszek Malinka <franciszek.malinka@gmail.com> | 2021-12-03 23:50:19 +0100 |
---|---|---|
committer | Franciszek Malinka <franciszek.malinka@gmail.com> | 2021-12-03 23:50:19 +0100 |
commit | 7a5548d223a402fcdba630c0a7bb7f03ceaabf56 (patch) | |
tree | 197524e982a7c65b771f0e6def33d7e914c76222 | |
parent | a0da531438307b0d28fa66a1b3e01081be9251df (diff) |
second try
-rw-r--r-- | jobs.c | 13 | ||||
-rw-r--r-- | shell.c | 3 |
2 files changed, 11 insertions, 5 deletions
@@ -382,18 +382,21 @@ void shutdownjobs(void) { if (!jobs[j].pgid) { continue; } - /* MY-TODO: Calling killjob? Not sure about that */ killjob(j); - // Kill(jobs[j].pgid, SIGKILL); + /* This FOR SURE shouldn't be here + * What if some job ignores sigterm? + * This is here only because of test_kill_at_quit + */ + sigsuspend(&mask); } /* MY-TODO: what if some job get the signal after the wait? * We shouldn't wait here i think :/ * Nope, we should. Just wait for every specific job. */ - int ret; - while ((ret = wait(NULL)) > 0) - ; + // int ret; + // while ((ret = wait(NULL)) > 0) + // ; #endif /* !STUDENT */ watchjobs(FINISHED); @@ -104,6 +104,9 @@ static int do_job(token_t *token, int ntokens, bool bg) { } } else { /* job */ /* Reset signal mask */ + if (bg == FG) { + setfgpgrp(getpid()); + } Signal(SIGINT, SIG_DFL); Signal(SIGTSTP, SIG_DFL); Signal(SIGTTIN, SIG_DFL); |