Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/IPC/System/Simple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use Scalar::Util qw(tainted);
use Config;
use constant WINDOWS => ($^O eq 'MSWin32');
use constant VMS => ($^O eq 'VMS');
use B;

BEGIN {

Expand Down Expand Up @@ -393,6 +394,12 @@ sub capturex {
# the parent.

print {$write_fh} int($!);

# Exiting will call all END{} blocks which typically messes up code
# which created them. Delete all such blocks before exiting.

@{; eval { B::end_av->object_2svref } || [] } = ();

exit(-1);
}

Expand Down
7 changes: 6 additions & 1 deletion t/12_systemx.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use strict;

use IPC::System::Simple qw(system systemx capture capturex);
use Config;
use Test::More tests => 7;
use Test::More tests => 8;

my $perl_path = $Config{perlpath};

Expand All @@ -12,6 +12,11 @@ if ($^O ne 'VMS') {
unless $perl_path =~ m/$Config{_exe}$/i;
}

my $pid = $$;
END {
is($$, $pid, "END Block Called in main process");
}

chdir("t"); # Ignore return, since we may already be in t/

my $exit_test = "$perl_path exiter.pl 0";
Expand Down