This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Background processes prevent terminal window from closing


On 5 May 2011 05:30, Ryan Dortmans wrote:
> Hi,
>
> I have found that background processes prevent the terminal window
> from closing. I have tried with the cmd terminal as well as mintty.
> Here is a simple example:
>
> $ notepad .profile &
> [1] 10260
> $ exit
> logout
>
> The window remains until I close the notepad window. I have also
> reproduced the issue using a simple looping shell script instead of a
> windows program.
>
> I thought that running disown would detach the process to turn it into
> a daemon, but this has no effect.

No, this just removes it from the shell's job control, but it still
remains connected to the terminal session.

> Is there any way to detach running background processes such that the
> terminal can be closed?

You can start a program in a separate session using the 'setsid'
utility from the util-linux package. I don't know whether it's
possible to detach a running process.

You can close the terminal anyway though using the Close button (or
Alt+F4 in the case of mintty), except of course that the background
process might also be closed, depending on its SIGHUP handling.

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]