screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delay when closing a window after starting a background process


From: Bob Proulx
Subject: Re: Delay when closing a window after starting a background process
Date: Sun, 15 Jul 2018 12:58:52 -0600
User-agent: Mutt/1.10.0 (2018-05-17)

Dun Peal wrote:
> This problem has been plaguing me for years now, and still now with
> the recent 4.6.2 release.

Ah!

> Steps to reproduce:
> 1. Start a new screen session.
> 2. Create a new window.
> 3. Hit Ctrl-D. Window closes instantly.
> 4. Start another windows.
> 5. Run the following bash command: sleep 100 &
> 6. Hit Ctrl-D. Window will hang in dead state until you kill the sleep
> process, or about 7-9 seconds elapse - whichever comes sooner.
> 
> I had a friend reproduce the problem on 4.6.2 in Arch Linux (I'm on
> Ubuntu) and another reproduce it on 4.05.00 (Debian 9).
> 
> Any ideas?

For one the stdout, stderr, and stdin are not redirected when
launching 'sleep 100' in the background.  Those file descriptors will
be attached and still open until the sleep process exits.  That is
what is keeping that terminal open.

If you want to launch a process into the background as a daemon then
redirect the three I/O file descriptors first.  Then the window close
will be immediate.

  sleep 100 >/dev/null 2>&1 </dev/null &

As to the why of the time delay before screen notices, that I don't
know, but perhaps zombie_timeout?

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]