See http://perlmonks.org/?node_id=1214521
Operation 'OPEN' not supported on FCGI::Stream handle at /usr/share/perl5/Net/OpenSSH.pm line 761.
The solution may be to untie STDERR and STDOUT before reopening them, os just use POSIX to avoid the Perl layer.