diff --git a/NEWS b/NEWS index 5dfadbc648d9ed5c6e3e71701aac3acfb4c47563..4c295ca402b5784d973f9409fb55338b861e3aff 100644 --- a/NEWS +++ b/NEWS @@ -204,6 +204,9 @@ documents those changes that are of interest to users and admins. ======================== -- Eliminate zombie process created if salloc exits with stopped child process. Patch from Gerrit Renker, CSCS. + -- With default configuration on non-Cray systems, enable salloc to be + spawned as a background process. Based upon work by Don Albert (Bull) and + Gerrit Renker (CSCS). * Changes in SLURM 2.2.6 ======================== diff --git a/src/salloc/salloc.c b/src/salloc/salloc.c index 57105026631c1488765f7cb333730d4d4151f6dd..8d47242c006d8d818725f0cd4e5519c83f4719bc 100644 --- a/src/salloc/salloc.c +++ b/src/salloc/salloc.c @@ -219,6 +219,7 @@ int main(int argc, char *argv[]) * a) input is from a terminal (stdin has valid termios attributes), * b) controlling terminal exists (non-negative tpgid), * c) salloc is not run in allocation-only (--no-shell) mode, + * NOTE: d and e below are configuration dependent * d) salloc runs in its own process group (true in interactive * shells that support job control), * e) salloc has been configured at compile-time to support background @@ -234,10 +235,10 @@ int main(int argc, char *argv[]) error("no controlling terminal: please set --no-shell"); exit(error_exit); } +#ifdef SALLOC_RUN_FOREGROUND } else if ((!opt.no_shell) && (pid == getpgrp())) { if (tpgid == pid) is_interactive = true; -#ifdef SALLOC_RUN_FOREGROUND while (tcgetpgrp(STDIN_FILENO) != pid) { if (!is_interactive) { error("Waiting for program to be placed in " @@ -246,8 +247,12 @@ int main(int argc, char *argv[]) } killpg(pid, SIGTTIN); } -#endif } +#else + } else if (!opt.no_shell) { + is_interactive = true; + } +#endif /* * Reset saved tty attributes at exit, in case a child * process died before properly resetting terminal.