Perl-Sensitive Sunglasses | |
PerlMonks |
Re: null output on programby atcroft (Abbot) |
on Nov 19, 2022 at 01:39 UTC ( [id://11148251]=note: print w/replies, xml ) | Need Help?? |
Short form: Were I to make a semi-educated guess, it would be this: You need to capture the output of both STDOUT and STDERR. Long form:
If you are using a *nix-y OS, you may be able to get what you expect by simply appending the string '2>&1' to the command (which in many shells redirects anything sent to STDERR to STDOUT). Alternately, if you use one of the IPC::Run* modules you may be able to capture the error output explicitly. All that to say that in your example the 'open' line would be changed to read: open("runmain","$commands{$PROGRAM} $TARGET_HOST 2>&1 |"); (Although you might want to consider checking if the open failed or not.) Hope that helps.
In Section
Seekers of Perl Wisdom
|
|