in reply to Open3 in child process not capturing errors correctly. .

open3 requires three different file handles for stdin, stdout and stderr. You're attempting to use the same one for stdout and stderr, which I suspect will only cause it to catch data being sent to stderr. Try breaking it up into 3 distinct file handles and deal with both stdout and stderr separately.

Update: My bad, guess you can do it that way.

  • Comment on Re: Open3 in child process not capturing errors correctly. .

Replies are listed 'Best First'.
RE: Re: Open3 in child process not capturing errors correctly. .
by geektron (Curate) on Oct 26, 2000 at 00:52 UTC
    not according to perldoc:
    perldoc IPC::Open3 snippage here. . . . DESCRIPTION Extremely similar to open2(), open3() spawns the given $cmd and connects RDRFH for reading, WTRFH for writing, and ERRFH for errors. If ERRFH is '', or the same as RDRFH, then STDOUT and STDERR of the child are on the same file handle. The WTRFH will have autoflush turned on. If WTRFH begins with "<&", then WTRFH will be closed in the parent, and the child will read from it directly. If RDRFH or ERRFH begins with ">&", then the child will send output directly to that file handle. In both cases, there will be a dup(2) instead of a pipe(2) made.

    the open3 STDOUT and STDERR can be on the same filehandle.