X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,TW_FD X-Spam-Check-By: sourceware.org X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+7dVGVlV2usWXgKZJPAVIj Date: Sun, 25 Nov 2012 15:34:57 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Replacing fork/exec with spawn question Message-ID: <20121125203457.GA22703@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <5561519E-4216-47A7-A020-EF2EA8E45A56 AT cloudwerx DOT com> <50B251D7 DOT 7010501 AT molconn DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50B251D7.7010501@molconn.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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 Sun, Nov 25, 2012 at 12:13:59PM -0500, LMH wrote: >It may be better to move such a discussion to a programing board since >some of this will not relate to cygwin and it would be nice to have >things like php formatted code, attachments, etc. The mods here can let >us know about that. I have thought at times that some of the code I have >here should be made into some kind of IPC API. Perhaps others would find >that useful. As a "mod" I can safely say that any topic which discusses how not to use Cygwin can safely be considered to be off-topic. However, if you're talking about Cygwin's version of spawn which is (IMO misguidedly) intended to mimic the spawn* functions in Windows then, if you are trying to use pipes, you will probably need to investigate how to use close-on-exec to close one side of the pipe while passing the other to the subprocess. You should be able to play games with fds using dup2, dup, and close-on-exec to force a pipe to be the stdin or stdout of a subprocess. It would be tricky but doable. http://pubs.opengroup.org/onlinepubs/009695399/functions/fcntl.html http://pubs.opengroup.org/onlinepubs/009695399/functions/dup2.html http://msdn.microsoft.com/en-US/library/20y988d2%28v=vs.80%29.aspx -- 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