From: Michael G. Schwern Date: Wed, 14 Nov 2001 13:19:15 +0000 (-0500) Subject: Fwd: [craigberry@mac.com: die_exit.t] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ffbead302b52559968ad72fad1732bf00a8b8fe7;p=p5sagit%2Fp5-mst-13.2.git Fwd: [craigberry@mac.com: die_exit.t] Message-ID: <20011114131915.K5096@blackrider> p4raw-id: //depot/perl@12998 --- diff --git a/t/op/die_exit.t b/t/op/die_exit.t index 18d8bab..fedef94 100755 --- a/t/op/die_exit.t +++ b/t/op/die_exit.t @@ -17,8 +17,6 @@ if ($^O eq 'mpeix') { $| = 1; -my $perl = -e '../perl' ? '../perl' : -e './perl' ? './perl' : 'perl'; - use strict; my %tests = ( @@ -46,16 +44,29 @@ my $max = keys %tests; print "1..$max\n"; +# Dump any error messages from the dying processes off to a temp file. +open(STDERR, ">die_exit.err") or die "Can't open temp error file: $!"; + foreach my $test (1 .. $max) { my($bang, $query, $code) = @{$tests{$test}}; $code ||= 'die;'; - my $exit = - (($^O eq 'MSWin32' || $^O eq 'NetWare') - ? system qq($perl -e "\$! = $bang; \$? = $query; $code" 2> nul) - : system qq($perl -e '\$! = $bang; \$? = $query; $code' 2> /dev/null)); + if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') { + system(qq{$^X -e "\$! = $bang; \$? = $query; $code"}); + } + else { + system(qq{$^X -e '\$! = $bang; \$? = $query; $code'}); + } + my $exit = $?; + + # VMS exit code 44 (SS$_ABORT) is returned if a program dies. We only get + # the severity bits, which boils down to 4. See L. + $bang = 4 if $^O eq 'VMS'; printf "# 0x%04x 0x%04x 0x%04x\n", $exit, $bang, $query; print "not " unless $exit == (($bang || ($query >> 8) || 255) << 8); print "ok $test\n"; } +close STDERR; +END { 1 while unlink 'die_exit.err' } +