Your skill will accomplish
what the force of many cannot
Why does IPC::System::Simple not capture output when Perl is running as CGI under IIS?by matterofact (Initiate)
|on Jul 10, 2013 at 15:36 UTC||Need Help??|
matterofact has asked for the
wisdom of the Perl Monks concerning the following question:
IIS 7.5 (Windows 7), Perl 5.16.3 (Strawberry Perl)
I'm trying to use IPC::System::Simple to run a command and capture the output, via either capture() or capturex() (they should both behave exactly the same under Windows). The Perl script is running as a web page under IIS, which has CGI handler mappings configured for Strawberry Perl. The problem is that the command runs and returns an exit value of 0, yet no output is captured. However, if I run the exact same code from a command prompt, it works fine. If I use IPC::System::Simple's system() replacement, output is printed, but not captured---it works fine. If I use backticks, it works fine.
Here are some examples to illustrate what's happening:
Exit value is 0, but no results are printed. If I change capture() to system(), the results are printed to the browser, and the exit value is still 0:
If I modify the script to this:
And then I run it from the shell, I see all the glorious output of svn info.
If I instead use backticks or qx//, and then run the script through IIS and hit the page in a browser, the output is captured and printed just fine.
So, it looks like capture() is not capturing, but only when running through IIS. It's not a permissions problem, because backticks work. In fact, the command itself is working (exit value of 0, output seen via system()). It's just that the output is escaping / being redirected somewhere / not being captured.