Hi Dyweni, sorry for delay. On Mon, Nov 06, 2023 at 06:01:55PM -0600, Dyweni - Util-Linux wrote: > Is there any idea on resolving this issue? What would be the best > way to prevent a session running inside screen from being > unexpectedly ended by script when the ssh connection to the server > is lost? > > I'd like to find the best approach before coding a solution. The > ideas I've had include: > * simply skipping sending the EOF to the child > * killing the child It uses EOF to emulate on the internal terminal how pipes work for example: echo "ps" | script We must send to the shell "ps" string and EOF and then *wait* for the shell to exit correctly. If we send SIGTERM without EOF and without waiting for shell termination, we will probably lose some output from the shell. It's because script(1) is faster than shell. But I can imagine that in some cases is this way unnecessary and just send a signal is good enough. So, add a new option to skip EOF and leave the main loop in ul_pty_proxy_master() and sending SIGTERM to the child may be a good idea. Send patch ;-) BTW, it would be nice to have the log from: SCRIPT_DEBUG=all script 2> log to see your session in details. Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com