delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/02/07/16:41:18

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <47AB7ACC.503@cyconix.com>
Date: Thu, 07 Feb 2008 21:40:28 +0000
From: Paul Leder <sa212+mingw AT cyconix DOT com>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Incomplete environ when running MinGW apps?
References: <5E25AF06EFB9EA4A87C19BC98F5C87531641A1 AT core-email DOT int DOT ascribe DOT com> <47AB31C7 DOT 3040909 AT cyconix DOT com> <47AB3B0B DOT 9060902 AT sbcglobal DOT net> <47AB4520 DOT 2050305 AT cyconix DOT com> <04d801c869b3$d97c8ce0$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <47AB4D05 DOT 2090207 AT cyconix DOT com> <04e101c869b8$3c90a330$2e08a8c0 AT CAM DOT ARTIMI DOT COM>
In-Reply-To: <04e101c869b8$3c90a330$2e08a8c0@CAM.ARTIMI.COM>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Dave Korn wrote:

>   Out of curiosity, what's the problem with just using popen("...") always?

I get the feeling you're working up to telling me something I don't want 
to hear, but I shall carry on regardless... :)

[_]popen is fine if you want to execute a process and either just get 
its stdout, or just supply its stdin, but not both (and you only want a 
console app; it's buggy, apparently). If you want all 3 of stin, stdout, 
and stderr redirected, as I do, you must (I think) use CreateProcess and 
do the donkey work yourself. I haven't investigated what _popen does to 
slashes and quotes, but it's presumably the same as 'system'.

You only need to use pipes at all because Windoze processes can't 
reliably inherit sockets. But, as it turns out, the process and pipe 
creation is not the difficult part of the problem anyway. The real 
bu**er is connecting the pipes to the socket that talks to the remote 
peer. Since select is broken, you have to do this with multiple threads 
and events, and async waits.

-Paul

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019