Skip to content

Commit c9dfa49

Browse files
committed
pty: send EOF to monitor on EIO
Problem: The pty monitor callback is not called when the pty "follower" has closed, i.e. all open handles using the pty have closed. However, this would be extremely useful information to share with the monitor. When an EIO error is receieved on the pty, send an EOF message to the monitor (len == 0) to indicate there are no more pty users.
1 parent 3882d20 commit c9dfa49

File tree

1 file changed

+7
-0
lines changed
  • src/common/libterminus

1 file changed

+7
-0
lines changed

src/common/libterminus/pty.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,12 @@ void pty_client_send_data (struct flux_pty *pty, void *data, int len)
425425
}
426426
}
427427

428+
void pty_client_monitor_send_eof (struct flux_pty *pty)
429+
{
430+
if (pty->monitor)
431+
(*pty->monitor) (pty, NULL, 0);
432+
}
433+
428434
static void pty_read (flux_reactor_t *r,
429435
flux_watcher_t *w,
430436
int revents,
@@ -452,6 +458,7 @@ static void pty_read (flux_reactor_t *r,
452458
flux_watcher_stop (pty->fdw);
453459
pty->wait_on_close = false;
454460
check_pty_complete (pty);
461+
pty_client_monitor_send_eof (pty);
455462
return;
456463
}
457464
llog_error (pty, "read: %s", strerror (errno));

0 commit comments

Comments
 (0)