diff --git a/src/salloc/salloc.c b/src/salloc/salloc.c index 19224b497d14783638c1e45cbda3f9aec11b86d1..a0c1ffb3bf9e96ab7b1a1f507ece1788d8da48cc 100644 --- a/src/salloc/salloc.c +++ b/src/salloc/salloc.c @@ -165,7 +165,11 @@ int main(int argc, char *argv[]) is_interactive = isatty(STDIN_FILENO); if (is_interactive) { bool sent_msg = false; - /* Wait as long as we are running in the background */ + /* + * Job control: interactive sub-processes run in the foreground + * process group of the controlling terminal. In order to grant + * this (tcsetpgrp), salloc needs to be in the foreground first. + */ while (tcgetpgrp(STDIN_FILENO) != (pid = getpgrp())) { if (!sent_msg) { error("Waiting for program to be placed in "