X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Fvm%2Fprep-disk;h=d6d85a24035886ff45477882873c49754a5a6920;hb=3c732bafbe5c72567659dfc0f397293027617c50;hp=10afa8f5530a7d79c117124d2ef74fa85841769f;hpb=e23c0d5dc156a42b3f5169cbac692cfc4fb6394d;p=pintos-anon diff --git a/grading/vm/prep-disk b/grading/vm/prep-disk index 10afa8f..d6d85a2 100755 --- a/grading/vm/prep-disk +++ b/grading/vm/prep-disk @@ -2,6 +2,7 @@ use strict; use Getopt::Long; +use POSIX; my ($pintos) = "pintos"; my ($os_disk) = "../../src/userprog/build/os.dsk"; @@ -27,7 +28,7 @@ if (! -e $os_disk) { our ($formatted) = 0; unlink $fs_disk; -xsystem ("$pintos make-disk '$fs_disk' 2"); +xsystem (0, "$pintos make-disk '$fs_disk' 2"); while (@ARGV) { put_file (shift (@ARGV)); } @@ -37,11 +38,13 @@ sub put_file { my ($cmd) = "$pintos -v --os-disk='$os_disk' --fs-disk='$fs_disk' put"; $cmd .= " -f", $formatted = 1 if !$formatted; $cmd .= " '$fn'"; - xsystem ($cmd); + xsystem (1, $cmd); } sub xsystem { - my ($cmd) = @_; + my ($expect, $cmd) = @_; print "$cmd\n"; - system ($cmd) == 0 || die "command failed\n"; + my ($code) = system ($cmd); + WIFEXITED ($code) && WEXITSTATUS ($code) == $expect + or die "command failed\n"; }