Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Thu, 02 Nov 2000 18:01:11 +0330 (GMT+03:30) From: jens AT uniweb DOT se Subject: Re: AW: Starting Programms in the background To: cygwin Message-id: <465937526.973175471248.JavaMail.root@colin.uniweb.se> MIME-version: 1.0 X-Mailer: Sun(TM) Web Access 1.2 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7BIT >Bjoern Kahl AG Resy wrote: >> >> On Thu, 2 Nov 2000, Corinna Vinschen wrote: >> >> > klaus DOT berndl AT sdm DOT de wrote: >> > > > > How can this be avoided, means how to exit bash regardless >> > > > of any still running background programs? >> >> > You're right, it happens on NT as well when starting >> > background processes from the console window. This does not happen when >> > starting background processes from a remote session via telnet/ssh. >> > Unfortunately you can't start GUI processes from a remote session. >> >> Hi! >> >> Just tried it too: >> >> bash exits cleanly, but the console-window stays open. >> (Tried >> bash> knews & >> >> >> -> "ps" doesnt show the bash any longer, >> "knews" PPID get set to "1") >> >> Question: >> How to disconnect from controlling terminal under cygwin? >> There seems no ioctl defined to do that. (looked for some weeks ago). > > setsid(2) > >> Maybe the console-window goes away, if a small wrapper is used, that >> disconnects from controlling tty and closes all io-channels to the >> terminal (stdin,stdout,stderr), then exec()s the real app. > >That doesn't help in the console window, only in remote sessions. >The daemons already do that and nohup(1) - which is that wrapper - >doesn't help either in the console window. > >I'm somewhat surprised. I'm using remote sessions all the time and >I'm starting my daemons as services so I didn't realize that problem >in NT before. > >Corinna I don't know what function in cygwin is used to start a new program from the bash prompt. But CreateProcess() with the parameter/flag DETACHED_PROCESS should create the new process detached from the console. But I don't know if that is only the contact with sdtin/stdout or if it also includes that the process is not a child of the console. Long time since I played with CreateProcess(). Jens Yllman -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com