in reply to system stdout redirected ok to a file but not to a variable.

It's a pity to read that there is a logical explanation for what is happening :-(

I'll try to go with the IPC::open3 option and see if I can control exit codes, and STDOUT / STDERR.

The this is this script needs to be some kind of generic Wrapper for a monitoring tool. Therefore I'm not sure which modules/libraries I have available there. that's why I needed to have the simpliest version.

Other possible solution might be to dump the stdout/stderr to a temp file and read it afterwards, but... did not want to "touch" anything on the server :-(

Thanks.

  • Comment on Re: system stdout redirected ok to a file but not to a variable.

Replies are listed 'Best First'.
Re^2: system stdout redirected ok to a file but not to a variable.
by locked_user sundialsvc4 (Abbot) on May 29, 2015 at 13:34 UTC

    Don’t worry excessively about that.   Temporary files get created and deleted all the time, even when you are not aware of it, in the ordinary course of the computer’s daily activities.   (File::Temp might be handy here.)   If you happen to be working in the Windows environment, you may encounter some of the subtle differences between the two systems.   I also notice that the perldoc page for IPC::Open3 seems to suggest that the author thinks that IPC::Run is “better,” although I notice also that it is quite a bit more feature-laden.