X-Spam-Check-By: sourceware.org Date: Mon, 27 Mar 2006 17:21:28 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: service interact with desktop broken between: 1.5.5 & 1.5.19 Message-ID: <20060327152128.GE20907@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <007e01c64de2$c95200a0$b3db87d4 AT multiplay DOT co DOT uk> <01ff01c64f42$079578f0$b3db87d4 AT multiplay DOT co DOT uk> <20060326143235 DOT GW10301 AT calimero DOT vinschen DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk 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 Mar 26 20:24, Lev Bishop wrote: > Thanks, Corinna. I can almost get it working now. Maybe you can > explain why this works: > > $ cygrunsrv -I cygtest -jid 'cygrunsrv test' -p '/cygdrive/c/i386/cmd.exe' \ > -0/dev/console -1/dev/console -2/dev/console > > Giving me a console running cmd.exe that I can, for example run bash in. > Whereas it fails if I put -p '/bin/bash' directly for the command. > > I experimented, and found that if I do the following: > $ cygrunsrv -I cygtest -jid 'cygrunsrv test' -p '/bin/bash' -a $'-c "\ > echo this is on STDOUT;\ > echo this is on STDERR >&2;\ > ls -l /proc/self/fd;\ > read -p \'Give me something on STDIN: \' input;\ > echo input was $input " ' \ > -0/dev/console -1/dev/console -2/dev/console > > Then I get a console window showing the messages to stdout and stderr, > the /proc/self/fd listing confirms that fd0 is open on /dev/console, > but the 'read' builtin hangs and doesn't read anything. So it looks > like standard input isn't getting properly mapped in this case, even > though stdout and stderr are. That's a long-standing problem in cygrunsrv. Child processes started from cygrunsrv are put in their own process group, thus being background processes. This is usually correct, since the applications running as services are usually daemon processes, and the stdio descriptors are usually redirected to /dev/null or log files. But in case of interactive processes which "redirect" their stdio descriptors to the existing console as above that's not quite right. Becoming a background process means for the child process hanging on input and the foreground process gets a signal and has to care for that. The foreground process here is cygrunsrv, but cygrunsrv doesn't care, so the process remains in the stopped state. The reason that this works with cmd is that cmd simply doesn't care for POSIX rubbish like controlling ttys or signals. I've applied a fix to cygrunsrv and uploaded the new version 1.14-1. Thanks for the above testcase, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/