term: don’t close PTY when client application dies

Closing it as soon as we detect that the client has died, means we may
not have drained it completely.

The PTY is either closed _by_ the client application, or by us when we
shutdown the terminal. Thus, leaving it open (until we call
term_shutdown()) is fine.
This commit is contained in:
Daniel Eklöf 2021-03-12 22:06:50 +01:00
parent 464851fac1
commit 329f2a488c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 3 additions and 10 deletions

View file

@ -108,6 +108,7 @@
exiting shell (https://codeberg.org/dnkl/foot/issues/366).
* Default value of `-t,--term` in `--help` output when foot was built
without terminfo support.
* Drain PTY when the client application terminates.
### Security

View file

@ -991,16 +991,8 @@ slave_died(struct reaper *reaper, pid_t pid, int status, void *data)
term->slave_has_been_reaped = true;
term->exit_status = status;
if (term->conf->hold_at_exit) {
/* The PTMX FDM handler may already have closed our end */
if (term->ptmx >= 0) {
fdm_del(term->fdm, term->ptmx);
term->ptmx = -1;
}
return;
}
term_shutdown(term);
if (!term->conf->hold_at_exit)
term_shutdown(term);
}
struct terminal *