X-Recipient: archive-cygwin AT delorie DOT com 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 MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 5 May 2011 05:42:58 +0100 Message-ID: Subject: Re: Background processes prevent terminal window from closing From: Andy Koppe To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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