Can subprocess point to file descriptor 5?

Discussion in 'Python' started by Steve Quezadas, May 3, 2006.

  1. 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
     
    Steve Quezadas, May 3, 2006
    #1
    1. Advertising

  2. Steve Quezadas wrote:

    > 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
     
    Diez B. Roggisch, May 3, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki

    Reading of file by next of map file and by next of file descriptor.

    =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki, Jul 10, 2007, in forum: C++
    Replies:
    1
    Views:
    816
    Alf P. Steinbach
    Jul 10, 2007
  2. Michel Lespinasse

    Descriptor leak in python 2.4 subprocess module

    Michel Lespinasse, Aug 28, 2008, in forum: Python
    Replies:
    0
    Views:
    328
    Michel Lespinasse
    Aug 28, 2008
  3. hiral
    Replies:
    2
    Views:
    618
    Jean-Michel Pichavant
    May 5, 2010
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,390
    Saraswati lakki
    Jan 6, 2012
  5. Roedy Green
    Replies:
    4
    Views:
    203
    Andreas Leitgeb
    Mar 22, 2014
Loading...

Share This Page