use File::Temp qw/ tempdir /;
use TestApp;
use File::Spec;
+use Carp qw/croak/;
+use IPC::Open3 qw(open3);
my $home = tempdir( CLEANUP => 1 );
my $path = File::Spec->catfile($home, 'testapp.psgi');
TestApp->psgi_app;
};
close($psgi);
-# Check we wrote out something that compiles
-system($^X, '-I', "$FindBin::Bin/../lib", '-c', $path)
- ? fail('.psgi does not compile')
- : pass('.psgi compiles');
+
+my @command = ($^X, '-I', "$FindBin::Bin/../lib", '-I', "$FindBin::Bin/../../lib", '-c', $path);
+open my $stdin, '<', File::Spec->devnull;
+my $pid = open3 $stdin, my $stdout, undef, @command;
+my $output = do { local $/; <$stdout> };
+waitpid $pid, 0;
+
+ok $? == 0, '.psgi compiles'
+ or diag $output;
# NOTE - YOU *CANNOT* do something like:
#my $psgi_ref = require $path;