The implementation of popen().

Jens Yllman jens@uniweb.se
Thu Mar 9 23:23:00 GMT 2000


 The problem with popen() under vc++ is that if I start a program with
popen(). That program can not start another program with popen(). Or
actually the program is started. It is just the the piping does not seem
to work. But if I compile it with gcc it works. The thing I'm doing is
running my program from a web server. And since it is a general program
reading configs to know what it does. It could be that my program calls
it self. And since this is a CGI program it 'pipes' data back with
stdout. And if that does not work recursivly it gets limited. On UNIX
this works great.

 Jens Yllman

Mikey wrote:
> 
> _popen() in vc++ uses the environment
> variable COMSPEC=XXX to figure out which
> shell to use (default command.com on 9x/cmd.exe on NT) , if you are trying
> to use mingw/vc++ _popen() from a program
> run under a cygwin shell, you will probably need
> to explicitly set COMSPEC to the shell you want
> to use, also the shell you use must be able
> to recognize /C instead of -c.
> 
> sh /C this_shell_script
> 
> won't work using cygwin sh/bash ;-)
> 
> On Thu, 09 Mar 2000 00:47:19 +0100, you wrote:
> 
> > There may be many reasons why it is that much code in the cygwin
> >implementation. And actually it is not much code in popen(). But it
> >calls fork() and that calls ... and so on and on. I just wondered if
> >someone here knew a way around the stupid implementation of popen() in
> >windows.
> >
> > Jens Yllman
> >
> >David Whitten wrote:
> >>
> >> >
> >> >  Hello,
> >> >
> >> >  I've a UNIX program that uses popen(). But when I try to use that with
> >> > _popen() that is in Win32 I can not call a program that uses _popen().
> >> > But this works with popen() in Cygwin. I've looked at the code in
> >> > Cygwin. And it as quite alot of code. So I just wonder if there is
> >> > anybody here who know what is realy needed to get it to work. Why I
> >> > don't use Cygwin for this project is because I link with a static
> >> > library that does only work with MS-Visual C++.
> >>
> >> If it works in cygwin, I assume that all of the code is necessary.
> >> Windows has some seriously limited code.
> >> Why would the Cygwin developers want to add more code if they didn't
> >> need to ?
> >>
> >> Dave
> >
> >--
> >------------------------------------------------------------
> >Uniweb AB                            Phone:  +46 8 626 42 00
> >P O Box 745                          FAX:    +46 8 626 42 01
> >S-191 27  SOLLENTUNA
> >SWEDEN                               http://www.uniweb.se/

-- 
------------------------------------------------------------
Uniweb AB                            Phone:  +46 8 626 42 00
P O Box 745                          FAX:    +46 8 626 42 01
S-191 27  SOLLENTUNA
SWEDEN                               http://www.uniweb.se/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list