Created
May 28, 2014 11:14
-
-
Save krimdomu/426c16867f8ec1d5abcb to your computer and use it in GitHub Desktop.
full stop rex execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use POSIX ":sys_wait_h"; | |
use Rex -feature => ['exit_status']; | |
group "servers", "localhost", "127.0.1.2"; | |
task test => group => servers => sub { | |
my $output = run "hostname"; | |
say $output; | |
die(); | |
}; | |
no warnings; | |
sub Rex::Fork::Task::wait { | |
my ($self) = @_; | |
my $rpid = waitpid($self->{pid}, &WNOHANG); | |
if($rpid == -1) { $self->{'running'} = 0; } | |
if(@Rex::Fork::Task::PROCESS_LIST && $Rex::Fork::Task::PROCESS_LIST[-1] != 0) { | |
die("full stop."); | |
} | |
return $rpid; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment