From cc0e2956ae662b2e2c9b60e525ecf8df6196b4c1 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 14 Feb 2011 15:59:41 +0000 Subject: [PATCH] comment why we require salloc to run in the foreground --- src/salloc/salloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/salloc/salloc.c b/src/salloc/salloc.c index 19224b497d1..a0c1ffb3bf9 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 " -- GitLab