X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <4E2089CB.4090608@valdetaro.com> References: <4E2089CB DOT 4090608 AT valdetaro DOT com> Date: Fri, 15 Jul 2011 20:22:05 +0100 Message-ID: Subject: Re: popen () fails when running from the windows prompt From: Andy Koppe To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id p6FJMO7o014841 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