Can subprocess point to file descriptor 5?

S

Steve Quezadas

Hello,

I tried posting this to the web forums without much luck.

I have some simple subprocess code here:
output = subprocess.Popen([/usr/bin/program"],
stdout=subprocess.PIPE).communicate()[0]

However, /usr/bin/prgram also outputs not only to stdout and stderr but
to file descriptor [5]. Can I redirect this output to either a file or a
variable?

- Steve
 
D

Diez B. Roggisch

Steve said:
Hello,

I tried posting this to the web forums without much luck.

I have some simple subprocess code here:
output = subprocess.Popen([/usr/bin/program"],
stdout=subprocess.PIPE).communicate()[0]

However, /usr/bin/prgram also outputs not only to stdout and stderr but
to file descriptor [5]. Can I redirect this output to either a file or a
variable?

I doubt it writes to fd 5 - instead, it will open a few files/sockets/pipes
and writes to them. One of them happens to get the 5 assigned as
filedescriptor. Figure out which one (I guess you used strace to get that
number the firest hand?), and if it's a file, just read the contents of it.
If its anything else, I'm pretty much out of ideas, but maybe others
aren't.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top