From: Graham Knop Date: Thu, 2 Jan 2014 02:17:25 +0000 (-0500) Subject: better diagnostics on shell test failures X-Git-Tag: v2.000004~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2Flocal-lib.git;a=commitdiff_plain;h=94ff402610700889a8d31a011a4d4dcd4c8223eb better diagnostics on shell test failures --- diff --git a/t/shell.t b/t/shell.t index 047d49c..a6b599b 100644 --- a/t/shell.t +++ b/t/shell.t @@ -107,19 +107,24 @@ sub call_ll { local $ENV{SHELL} = $info->{shell}; + my $script + = `"$^X" $extra_lib -Mlocal::lib$option` . "\n" + . qq{$info->{perl} -Mt::lib::ENVDumper -e1\n}; + my $file = File::Temp->new( TEMPLATE => 'll-test-script-XXXXX', TMPDIR => 1, SUFFIX => '.'.$info->{ext}, ); - - $file->print(scalar `"$^X" $extra_lib -Mlocal::lib$option` . "\n"); - $file->print(qq{$info->{perl} -Mt::lib::ENVDumper -e1\n}); - $file->close; + print { $file } $script; + close $file; my $opt = $info->{opt} ? "$info->{opt} " : ''; - my $out = `"$info->{shell}" $opt"$file"`; + my $cmd = qq{"$info->{shell}" $opt"$file"}; + my $out = `$cmd`; if ($?) { + diag "script:\n$script"; + diag "running:\n$cmd"; die "failed with code: $?"; } my $VAR1;