be gentle when redirecting stdout and stderr to make passenger 4 happy

This patch allows this gem to run under Passenger 4. Instead of touching global STDOUT and STDERR streams, it temporarily modifies $stdout and $stderr and restores them back afterwards (maybe the restoration is not needed, but I just tried to be safe).