+sub stopvms {
+ kill KILL => $_->pid for values %vm;
+ %vm = %pid = ();
+}
+
+sub execlist_finish {
+ my ($vm, $kill) = @_;
+
+ if ($vm{$vm}) {
+ warn "Cannot kill VM\n" if $kill;
+ $vm{$vm}->expect(5, '# ');
+ } else {
+ kill KILL => $pid{$vm} if $kill;
+ waitpid $pid{$vm}, 0;
+ }
+ write_file "time-stop-$vm", time;
+ return if $kill;
+
+ my $er = "exec-result-$vm";
+ die "gruntmaster-exec died\n" if -z $er;
+ my ($excode, $exmsg) = read_file $er;
+ unlink $er;
+ chomp ($excode, $exmsg); ## no critic (ProhibitParensWithBuiltins)
+ get_logger->trace("Exec result from $vm: $excode $exmsg");
+ die [$excode, $exmsg] if $excode; ## no critic (RequireCarping)
+}