Skip to content

Commit 67cc8b2

Browse files
committed
flux-job: attach: avoid watching output eventlog twice
Problem: There is a potential for flux-job to call the function attach_output_start() twice when pty.capture and pty.interactive are enabled for the job. This causes the output eventlog to be watched twice and duplicates lines of ouput. Make attach_output_start() idempotent, i.e. don't do anything if the output eventlog is already being watched.
1 parent 9ddb344 commit 67cc8b2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/cmd/flux-job.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,9 @@ void attach_stdin_cb (flux_reactor_t *r, flux_watcher_t *w,
19331933
*/
19341934
void attach_output_start (struct attach_ctx *ctx)
19351935
{
1936+
if (ctx->output_f)
1937+
return;
1938+
19361939
if (!(ctx->output_f = flux_job_event_watch (ctx->h,
19371940
ctx->id,
19381941
"guest.output",

0 commit comments

Comments
 (0)