sub execute { my $infoHR = shift; my $setupHR = shift; my $path; my $command; $path = $infoHR->{PATH}{$setupHR->{list}->{pth}}; $command = $infoHR->{COMMAND}{$setupHR->{list}->{cmd}}; $path =~ s/^\s+//; $path =~ s/\s+$//; $command =~ s/^\s+//; $command =~ s/\s+$//; changeDirectory($path) || die "Unable to change dir to $path\n"; my $done:shared = 0; my $failed:shared = 0; my @systemOut:shared; async { @systemOut = `$command 2>&1`; if($?) { $failed = 1; } $done = 1; }->detach; until($done) { for(1 .. 20 ) { sleep 1; last if $done; } verbose(Running, $command); } unless($failed) { verbose(Success, $command); return 1; } return errFound($setupHR, Error $command); }