From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8064 invoked by alias); 5 May 2011 04:43:16 -0000 Received: (qmail 7931 invoked by uid 22791); 5 May 2011 04:43:13 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-qy0-f171.google.com (HELO mail-qy0-f171.google.com) (209.85.216.171) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 May 2011 04:42:59 +0000 Received: by qyj19 with SMTP id 19so3962232qyj.2 for ; Wed, 04 May 2011 21:42:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.78.135 with SMTP id l7mr1513620qck.122.1304570578118; Wed, 04 May 2011 21:42:58 -0700 (PDT) Received: by 10.229.245.138 with HTTP; Wed, 4 May 2011 21:42:58 -0700 (PDT) In-Reply-To: References: Date: Thu, 05 May 2011 04:43:00 -0000 Message-ID: Subject: Re: Background processes prevent terminal window from closing From: Andy Koppe To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-05/txt/msg00029.txt.bz2 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