Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

It's been a while since I used IPC::Open3, though I have used it in the past. If I am remembering correctly (the manual page is a little spare, unfortunately), the filehandles you pass in are then created for you as dupes of the relevant file handles from the child process. What this means in the short form is this: opening the two ahead of time and passing them in did nothing, they were closed and re-opened using dup() on the STDERR and STDOUT of the child.

More specifically, the idea of open3() is to give you (your program) the ability to read off those two file descriptors locally. So, after a successful return from open3, you should have been able to read off of OUTPUT and ERRLOG as if you had opened them for reading. Because of potential blocking issues, you are encouraged to use select before trying to read off of either handle.

In your case, where you want the output to go to specific files, according to the manual page you should open those filehandles with ">&", not just ">" as you are doing in your code. Try changing those lines, and see if that helps. If not, you can try doing the reading yourself.

And don't feel too bad-- I find the manual page here to be pretty unclear, as well.

--rjray


In reply to Re: IPC::Open3 woes by rjray
in thread IPC::Open3 woes by BazB

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-19 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found