We're having two events to watch out for. PTY may be closed and the process may exit. One does not imply the other. We are about to consider the PTY session to be finished whenever one of those two conditions arise, no matter which one comes in first. Sometimes (e.g. quick exit, e.g. just spawning /bin/true as shell) the process will terminate so fast, that we didn't even fully initialize the GUI. We need to properly terminate on that condition as well as expect that both events (PTY closed and process terminated) happens at the same time. Both events call onClosed(). This is why i've guarded it with a mutex to avoid concurrent calling (which happened before).
NOTES
We're having two events to watch out for. PTY may be closed and the process may exit. One does not imply the other. We are about to consider the PTY session to be finished whenever one of those two conditions arise, no matter which one comes in first. Sometimes (e.g. quick exit, e.g. just spawning
/bin/true
as shell) the process will terminate so fast, that we didn't even fully initialize the GUI. We need to properly terminate on that condition as well as expect that both events (PTY closed and process terminated) happens at the same time. Both events callonClosed()
. This is why i've guarded it with a mutex to avoid concurrent calling (which happened before).