Re: popen, file descriptors, etc.

james anderson <[email protected]>
Newsgroups gmane.lisp.cclan.general,gmane.lisp.mcl.general
Message-ID <[email protected]>
On Wednesday, Jan 21, 2004, at 10:13 Europe/Berlin, Gary Byers wrote:

>>> ...
> popen uses the shell to execute the command, so if tar's verbose
> output is indeed going to /dev/console in this case you can ask
> the shell to redirect it for you:

it was indeed there.

>
> "tar -C SOME-DIRECTORY -zxvf SOME-FILE 2>&1"
>
> where the "2>&1" is so obvious and intuitive that it's barely
> worth mentioning that it causes the process to run with file
> descriptor 2 set to a duplicate of fd 1.

evidently the description in the sh man page
        [n1]>&n2
               Duplicate standard output (or n) from n2.

was even more obvious to me, as i did try this, but got it backwards.

ok.
so now the next question: is popen specified to run sh in all unix 
versions?

...



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.