Skip to content

Commit 666fb9c

Browse files
authored
Merge pull request #5229 from garlick/subprocess_fixes
libsubprocess: fail with ESRCH when pid cannot be found
2 parents af619fb + 6f4c1b9 commit 666fb9c

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/common/libsubprocess/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ int remote_exec (flux_subprocess_t *p)
601601
flux_future_t *f;
602602
int flags = 0;
603603

604-
if (p->ops.on_channel_out)
604+
if (zlist_size (cmd_channel_list (p->cmd)) > 0)
605605
flags |= SUBPROCESS_REXEC_CHANNEL;
606606
if (p->ops.on_stdout)
607607
flags |= SUBPROCESS_REXEC_STDOUT;

src/common/libsubprocess/server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static flux_subprocess_t *proc_find_bypid (subprocess_server_t *s, pid_t pid)
102102
return p;
103103
p = zlistx_next (s->subprocesses);
104104
}
105-
errno = ENOENT;
105+
errno = ESRCH;
106106
return NULL;
107107
}
108108

t/t0005-rexec.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,9 @@ test_expect_success NO_CHAIN_LINT 'ps, kill fail remotely on rank 0' '
278278
wait_rexec_process_count 0 0
279279
'
280280

281+
test_expect_success NO_CHAIN_LINT 'kill fails with ESRCH when pid is unknown' '
282+
test_must_fail $rexec_script kill 15 12345678 2>kill.err &&
283+
grep "No such process" kill.err
284+
'
285+
281286
test_done

0 commit comments

Comments
 (0)