-sub execlist {
- my (@args) = @_;
- my $ret = fork // die 'Cannot fork';
- if ($ret) {
- waitpid $ret, 0;
- die "gruntmaster-exec died\n" if -z 'exec-result';
- my ($excode, $exmsg) = read_file 'exec-result';
- unlink 'exec-result';
- chomp ($excode, $exmsg);
- die [$excode, $exmsg] if $excode > 0;
- } else {
- open STDOUT, '>exec-result';
- exec 'gruntmaster-exec', @args;
- }
+our (%vm);
+
+sub runvm {
+ my ($name) = @_;
+ return unless $ENV{GRUNTMASTER_VM};
+ mkfifo "$name.in", 0600;
+ mkfifo "$name.out", 0600;
+ get_logger->trace("Starting VM $name");
+ $vm{$name} = Expect::Simple->new({
+ Cmd => "$ENV{GRUNTMASTER_VM} $name",
+ Prompt => '# ',
+ DisconnectCmd => 'exit',
+ RawPty => 1,
+ Timeout => 10,
+ });