in reply to Issues with IPC::Open3 on win32
Hello dracos
ok, I am having issues with the following code STDERR seems to be ending up in the STDOUT handle on the open3
In the first paragraph of the Documentation for IPC::open3 http://perldoc.perl.org/IPC/Open3.html the behaviour you are describing as a problem is outlined.
DESCRIPTION
Extremely similar to open2(), open3() spawns the given $cmd and connects CHLD_OUT for reading from the child, CHLD_IN for writing to the child, and CHLD_ERR for errors. If CHLD_ERR is false, or the same file descriptor as CHLD_OUT, then STDOUT and STDERR of the child are on the same filehandle (this means that an autovivified lexical cannot be used for the STDERR filehandle, see SYNOPSIS). The CHLD_IN will have autoflush turned on.
Your $err is uninitialised, so returns false of undef, and the module behaves accordingly.
The SYNOPSIS of how to set the $err variable shows the use of the Symbol module and setting a literal, due to the autovivified lexical rule. You will need to look that up. The Documentation does mention that IPC::Run has better error handling so there is another option.
Hth
|
|---|