diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-10-27 22:15:15 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-10-27 22:15:15 +0000 |
commit | 74cfb115ac810480c0000dc742b20383c1578bac (patch) | |
tree | 316d96e5123617976f1637b143570c309a662045 /gnu/usr.bin/perl/t/op/die_exit.t | |
parent | 453ade492b8e06c619009d6cd52a85cb04e8cf17 (diff) |
stock perl 5.8.0 from CPAN
Diffstat (limited to 'gnu/usr.bin/perl/t/op/die_exit.t')
-rw-r--r-- | gnu/usr.bin/perl/t/op/die_exit.t | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gnu/usr.bin/perl/t/op/die_exit.t b/gnu/usr.bin/perl/t/op/die_exit.t index a389946fe37..fedef945e1e 100644 --- a/gnu/usr.bin/perl/t/op/die_exit.t +++ b/gnu/usr.bin/perl/t/op/die_exit.t @@ -15,7 +15,7 @@ if ($^O eq 'mpeix') { exit 0; } -my $perl = -e '../perl' ? '../perl' : -e './perl' ? './perl' : 'perl'; +$| = 1; use strict; @@ -44,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' - ? 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<perlvms/$?>. + $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' } + |