This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Replacing fork/exec with spawn question
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