delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/06/28/09:07:18

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Envelope-Sender-Is: Andrej DOT Borsenkow AT mow DOT siemens DOT ru (at relayer david.siemens.de)
From: "Andrej Borsenkow" <Andrej DOT Borsenkow AT mow DOT siemens DOT ru>
To: "Brian Michael Genisio" <genisiob AT pilot DOT msu DOT edu>,
<cygwin AT sources DOT redhat DOT com>
Subject: RE: system() not working as expected...
Date: Thu, 28 Jun 2001 17:03:20 +0400
Message-ID: <001201c0ffd2$b46e5ac0$21c9ca95@mow.siemens.ru>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
In-Reply-To: <200106281254.f5SCs4820618@pilot21.cl.msu.edu>
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2479.0006
Importance: Normal


> -----Original Message-----
> From: cygwin-owner AT sources DOT redhat DOT com
> [mailto:cygwin-owner AT sources DOT redhat DOT com]On Behalf Of Brian Michael
> Genisio
> Sent: Thursday, June 28, 2001 4:54 PM
> To: cygwin AT sources DOT redhat DOT com
> Subject: system() not working as expected...
>
>
> Hello, I am having the following problem... I am trying to port a
> program that
> uses the system call.  It works fine if I call it from the cygwin
> environment's
> bash shell, but if I just run bash.exe from a dos prompt, and run
> the program,
> the system() call does not work.
>
> Here is an example :
> int main(void)
> {
>    system("dir");
> }
>
> If I compile and run from the bash command line, it works great.
> Next, on a
> clean system, I copy the sample program, bash.exe, dir.exe and
> cygwin1.dll to a
> directory, and run bash.exe.  Now, I call the sample program, and it exits
> normally.
>
> My first thought was that stdout was not displaying correctly, so
> I tried :
> system("dir >junkfile") I got the same results... junkfile was
> created in the
> cygwin environment, and not in the raw bash environment.
>
> My next thought was that the paths were being confused somehow, so I tried
> compiling with system("$PWD/dir") and absolute paths... still, I
> get the same
> results.
>
> Any Ideas?

system() runs programs using /bin/sh; it is efectively

/bin/sh -c "your command line"

-andrej


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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