X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Faggregate%2Fpsgi_file.t;h=1f8f0c5aa443102e410ff35002ca3bd7f818c007;hp=7327d4aab333234f0d8c71dbbaeeae0ce256777d;hb=e60dd0d7930fa5ee5edc23e6548da816f400f6d5;hpb=e60068484721132e6fe1855f53f9542d8bb17a35 diff --git a/t/aggregate/psgi_file.t b/t/aggregate/psgi_file.t index 7327d4a..1f8f0c5 100644 --- a/t/aggregate/psgi_file.t +++ b/t/aggregate/psgi_file.t @@ -6,6 +6,8 @@ use lib "$FindBin::Bin/../lib"; 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'); @@ -19,10 +21,15 @@ use TestApp; 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;