delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/05/05/07:38:51

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-IronPortListener: Outbound_SMTP
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AiYBAH+Lwk2cKEcV/2dsb2JhbACYEY4kd6pBm1+GBwSUCoor
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
Message-ID: <0105D5C1E0353146B1B222348B0411A209E8030C92@NIHMLBX02.nih.gov>
References: <BANLkTin2LqmSCJ8CdjSCNLTiPO8_sOknpg AT mail DOT gmail DOT com>
In-Reply-To: <BANLkTin2LqmSCJ8CdjSCNLTiPO8_sOknpg@mail.gmail.com>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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=3D"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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019