This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: popen () fails when running from the windows prompt
- From: Andy Koppe <andy dot koppe at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 15 Jul 2011 20:22:05 +0100
- Subject: Re: popen () fails when running from the windows prompt
- References: <4E2089CB.4090608@valdetaro.com>
On 15 July 2011 19:41, Luiz Claudio Valdetaro wrote:
> i,
>
> 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"
It's because popen() requires /bin/sh.
Andy
--
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