This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Background processes prevent terminal window from closing
- From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder at niaid dot nih dot gov>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>, 'Ryan Dortmans' <ryandort dot cygwin at gmail dot com>
- Date: Thu, 5 May 2011 07:38:28 -0400
- Subject: RE: Background processes prevent terminal window from closing
- References: <BANLkTin2LqmSCJ8CdjSCNLTiPO8_sOknpg@mail.gmail.com>
Ryan Dortmans sent the following at Thursday, May 05, 2011 12:30 AM
>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.
>
>Is there any way to detach running background processes such that the
>terminal can be closed?
Why not use cygstart to launch it already "detached"?
You might create the following alias in your profile or .bashrc.
alias notepad="cygstart '$(cygpath -u -W)/notepad.exe'"
But if you do not want to be limited file in the current working
directory, use a function.
notepad ()
{
cygstart "$(cygpath -u -W)/notepad.exe" "$(cygpath -w "$1")"
}
You might have to change -W to -S in the first cygpath, if notepad.exe
is in $SYSDIR but not WINDIR. (In my instance of XP, it is in both.)
Best wishes,
- Barry
Disclaimer: Statements made herein are not made on behalf of NIAID.
--
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