guestOS = "linux"
floppy0.present = FALSE
memsize = $mem
+EOF
+ print VMX <<EOF if $serial;
serial0.present = TRUE
serial0.fileType = "file"
serial0.fileName = "pintos.out"
my ($boots) = 0;
local ($|) = 1;
for (;;) {
- if (waitpid ($pid, WNOHANG) == 0) {
+ if (waitpid ($pid, WNOHANG) != 0) {
# Subprocess died. Pass through any remaining data.
print $buf while sysread ($in, $buf, 4096) > 0;
last;
# Read and print out pipe data.
my ($len) = length ($buf);
- last if sysread ($in, $buf, 4096, $len) <= 0;
+ waitpid ($pid, 0), last
+ if sysread ($in, $buf, 4096, $len) <= 0;
print substr ($buf, $len);
# Remove full lines from $buf and scan them for keywords.
}
}
}
+ } else {
+ waitpid ($pid, 0);
}
- waitpid ($pid, 0);
alarm (0);
&$cleanup ();
sub relay_signal {
my ($pid, $signal, $cleanup) = @_;
kill $signal, $pid;
- File::Temp::cleanup();
+ eval { File::Temp::cleanup() }; # Not defined in old File::Temp.
&$cleanup ();
$SIG{$signal} = 'DEFAULT';
kill $signal, getpid ();