delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/10/28/03:25:01

Date: Sat, 28 Oct 2000 09:25:28 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Peter J. Farley III" <pjfarley AT banet DOT net>
Message-Id: <9003-Sat28Oct2000092528+0200-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.5h
CC: djgpp-workers AT delorie DOT com
In-reply-to: <4.3.1.0.20001027192402.00b199b0@pop5.banet.net>
(pjfarley AT banet DOT net)
Subject: Re: Bash 2.04 beta 6a
References: <200010270805 DOT KAA00023 AT lws256 DOT lu DOT erisoft DOT se>
<200010270805 DOT KAA00023 AT lws256 DOT lu DOT erisoft DOT se> <4 DOT 3 DOT 1 DOT 0 DOT 20001027192402 DOT 00b199b0 AT pop5 DOT banet DOT net>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Fri, 27 Oct 2000 19:33:02 -0400
> From: "Peter J. Farley III" <pjfarley AT banet DOT net>
> 
> BTW, the DJGPP perl "popen"/"pclose" wrapper/substitutes that Laszlo 
> pointed me to use system() exclusively for the command execution, both 
> for read and write pipes.  But the wrapper also uses dup/dup2 on stdout 
> (for read pipes) or stdin (for write pipes) around the calls to 
> system().

Note that popen/pclose from our libc also redirect handles with
dup/dup2 and call system() to run the subsidiary program.

> So DJGPP perl is using strictly system(), and now I need to 
> find out what perl uses elsewhere.  And maybe what a *ix popen/pclose 
> really use.

I'd expect a Unix system to do this inside popen:

    call pipe() to open a pipe
    call fork() to start the child program
    in the child-program's branch of fork, call exec("sh -c 'command-line'")
    in the parent-program's branch, read and write the pipe
    when wait() says the child exited, close the pipes and cleanup

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019