Return $? back safely
This commit is contained in:
parent
03318dc6e8
commit
8ce0412a8f
2 changed files with 3 additions and 6 deletions
|
@ -124,12 +124,10 @@ sub run {
|
||||||
croak "Run must be given a codref to run" unless ref $code eq "CODE";
|
croak "Run must be given a codref to run" unless ref $code eq "CODE";
|
||||||
|
|
||||||
$self->pre_setup(%args);
|
$self->pre_setup(%args);
|
||||||
$self->_subprocess(sub {
|
return $self->_subprocess(sub {
|
||||||
$self->post_setup(%args);
|
$self->post_setup(%args);
|
||||||
$code->(%args);
|
$code->(%args);
|
||||||
}, %args);
|
}, %args);
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -5,11 +5,9 @@ BEGIN {
|
||||||
use Test::More;
|
use Test::More;
|
||||||
use Test::SharedFork;
|
use Test::SharedFork;
|
||||||
|
|
||||||
# test 1
|
|
||||||
use Sys::Linux::Namespace;
|
use Sys::Linux::Namespace;
|
||||||
$Sys::Linux::Namespace::debug = 1;
|
$Sys::Linux::Namespace::debug = 1;
|
||||||
|
|
||||||
# test 2
|
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip "Need to be root to run test", 5 unless $< == 0;
|
skip "Need to be root to run test", 5 unless $< == 0;
|
||||||
ok(my $namespace = Sys::Linux::Namespace->new(private_tmp => 1), "Setup object");
|
ok(my $namespace = Sys::Linux::Namespace->new(private_tmp => 1), "Setup object");
|
||||||
|
@ -25,7 +23,8 @@ SKIP: {
|
||||||
is_deeply([grep {m|/proc/\d+/|} glob '/proc/*/'], ['/proc/1/'], "Only /proc/1/ exists");
|
is_deeply([grep {m|/proc/\d+/|} glob '/proc/*/'], ['/proc/1/'], "Only /proc/1/ exists");
|
||||||
});
|
});
|
||||||
|
|
||||||
ok($ret, "run code in sandbox");
|
# namespace process exited cleanly
|
||||||
|
ok($ret == 0, "run code in sandbox");
|
||||||
|
|
||||||
alarm(5);
|
alarm(5);
|
||||||
$pid_ns->run(code => sub {
|
$pid_ns->run(code => sub {
|
||||||
|
|
Loading…
Add table
Reference in a new issue