popen () fails when running from the windows prompt

Luiz Claudio Valdetaro luizclaudio@valdetaro.com
Fri Jul 15 18:41:00 GMT 2011


I am planning a minimalistic installation of my application using 
cygwin. Everything works fine, except that popen() fails when running 
from the windows prompt.

If I ran from the bash shell prompt of cygwin , it works fine. It is the 
only api I use that is failing. I created a simple, test program to 
narrow the issue,  and it also fails.

my intention is an installation with just my app, plus the cygwin.dll, 
as little files as possible.

This is my test program:

main (argc,argv)
int argc;
unsigned char *argv[];
FILE *f;
char command[80]="ls -l CGI-BIN";
char response[200];
     f = popen (command,"r");
     if (f == NULL) {
        puts ("stream error");
        exit (0);
      while (fgets(response,199,f) != NULL) {
         puts (response);
    fclose (f);

The program allays fails printing "stream error"

I guess that might be some additional setup I'm missing, such as 
environment variables?

I apreciate any help you guys can give.



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

More information about the Cygwin mailing list