Skip to content

Commit 6597d10

Browse files
committed
shell: add pty 'capture' member to shell.init context
Problem: If a user launches an interactive instance (i.e. flux alloc) with `-o pty.capture`, then data from the pty is duplicated into the output eventlog for later use. However, there is no way for an end user (e.g. flux job attach) to know definitively if that data is duplicated, because there is no way to easily discover (besides fetching the original jobspec) if capture mode was enabled. If capture mode is enabled with an interactive pty, add `"capture":1` to the shell.init event. This will give flux-job the hint it needs to determine that data in the output eventlog for rank 0 is duplicated from the pty output.
1 parent 35129ef commit 6597d10

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/shell/pty.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,21 @@ static int pty_init (flux_plugin_t *p,
342342
shell_log_errno ("flux_shell_add_event_context (pty)");
343343
goto error;
344344
}
345+
if (capture) {
346+
/*
347+
* If also capturing the pty output for an interactive
348+
* pty, note this in the shell.init event context. This
349+
* will hint to the pty reader that the terminal output
350+
* is duplicated for rank 0.
351+
*/
352+
if (flux_shell_add_event_context (shell,
353+
"shell.init",
354+
0,
355+
"{s:i}",
356+
"capture", 1) < 0) {
357+
shell_log_errno ("flux_shell_add_event_context (capture)");
358+
}
359+
}
345360
/* Ensure that rank 0 pty waits for client to attach
346361
* in pty.interactive mode, even if pty.capture is also
347362
* specified.

0 commit comments

Comments
 (0)