Skip to content

Instantly share code, notes, and snippets.

@krimdomu
Created May 28, 2014 11:14
Show Gist options
  • Save krimdomu/426c16867f8ec1d5abcb to your computer and use it in GitHub Desktop.
Save krimdomu/426c16867f8ec1d5abcb to your computer and use it in GitHub Desktop.
full stop rex execution
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