propagate mirabelle failures properly;
authorkrauss
Mon, 21 Mar 2011 12:43:25 +0100
changeset 42034 a77df5241959
parent 42033 60350051ef93
child 42035 fb155c75072d
propagate mirabelle failures properly; flatten obscure return code semantics of Perl system command to 0/1
src/HOL/Mirabelle/lib/Tools/mirabelle
src/HOL/Mirabelle/lib/scripts/mirabelle.pl
--- a/src/HOL/Mirabelle/lib/Tools/mirabelle	Mon Mar 21 12:43:23 2011 +0100
+++ b/src/HOL/Mirabelle/lib/Tools/mirabelle	Mon Mar 21 12:43:25 2011 +0100
@@ -56,6 +56,12 @@
   exit 1
 }
 
+function fail()
+{
+  echo "$1" >&2
+  exit 2
+}
+
 
 ## process command line
 
@@ -103,6 +109,6 @@
 
 for FILE in "$@"
 do
-  perl -w "$MIRABELLE_HOME/lib/scripts/mirabelle.pl" "$FILE"
+  perl -w "$MIRABELLE_HOME/lib/scripts/mirabelle.pl" "$FILE" || fail "Mirabelle failed."
 done
 
--- a/src/HOL/Mirabelle/lib/scripts/mirabelle.pl	Mon Mar 21 12:43:23 2011 +0100
+++ b/src/HOL/Mirabelle/lib/scripts/mirabelle.pl	Mon Mar 21 12:43:25 2011 +0100
@@ -118,7 +118,7 @@
 
 my $root_file = "$output_path/ROOT_$thy_name.ML";
 open(ROOT_FILE, ">$root_file") || die "Cannot create file '$root_file'";
-print ROOT_FILE "use_thy \"$path/$new_thy_name\";\n";
+print ROOT_FILE "use_thy \"$path/$new_thy_name\" handle _ => exit 1;\n";
 close(ROOT_FILE);
 
 
@@ -150,4 +150,4 @@
 unlink $setup_file;
 unlink $new_thy_file;
 
-exit $result;
+exit ($result ? 1 : 0);