From fc71fd57449be7d4d7ac8f72600967cd4484ce0d Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Sat, 27 Aug 2005 17:08:48 +0000 Subject: [PATCH] * fix place where Jeff changed an exit to a return and we really wanted it to be an exit. * Put the srun process (or what is about to become the srun process) in it's own process group so that group-wide signals (such as the SIGINT sent by hitting cntl-c in a shell) are not sent to the srun process. This commit was SVN r7068. --- orte/mca/pls/slurm/pls_slurm_module.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/orte/mca/pls/slurm/pls_slurm_module.c b/orte/mca/pls/slurm/pls_slurm_module.c index 749e57de1e..188307e807 100644 --- a/orte/mca/pls/slurm/pls_slurm_module.c +++ b/orte/mca/pls/slurm/pls_slurm_module.c @@ -366,11 +366,23 @@ static int pls_slurm_start_proc(int argc, char **argv, char **env) "pls:slurm:start_proc: fork failed"); return ORTE_ERR_IN_ERRNO; } else if (0 == srun_pid) { + /* get the srun process out of orterun's process group so that + signals sent from the shell (like those resulting from + cntl-c) don't get sent to srun */ + setpgid(0, 0); + opal_output(orte_pls_base.pls_output, "pls:slurm:start_proc: exec failed"); execve(exec_argv, argv, env); - return ORTE_ERR_IN_ERRNO; + /* don't return - need to exit - returning would be bad - + we're not in the calling process anymore */ + exit(1); } + /* just in case, make sure that the srun process is not in our + process group any more. Stevens says always do this on both + sides of the fork... */ + setpgid(srun_pid, srun_pid); + return ORTE_SUCCESS; }