X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2FmatitacLib.ml;h=ec722490ab07863238622c7e1f0d2cda14ddbaa9;hb=cb408b9ea336cd8efb990f7a1c88b566ccf0bd2e;hp=fbc393cfb3bed6472ae6de4874975b3786c632ff;hpb=6857e22b8a58162893119f7747c5848031fd59ce;p=helm.git diff --git a/helm/matita/matitacLib.ml b/helm/matita/matitacLib.ml index fbc393cfb..ec722490a 100644 --- a/helm/matita/matitacLib.ml +++ b/helm/matita/matitacLib.ml @@ -98,6 +98,14 @@ let rec go () = MatitaLog.error (sprintf "Parse error at %d-%d: %s" x y err); go () | exn -> MatitaLog.error (Printexc.to_string exn); go () + +let clean_exit n = + match !status with + None -> exit n + | Some status -> + let baseuri = MatitaTypes.get_string_option !status "baseuri" in + MatitacleanLib.clean_baseuris ~verbose:false [baseuri]; + exit n let main ~mode = Helm_registry.load_from "matita.conf.xml"; @@ -140,7 +148,7 @@ let main ~mode = begin MatitaLog.error "there are still incomplete proofs at the end of the script"; - exit 2 + clean_exit 2 end else begin @@ -157,19 +165,23 @@ let main ~mode = | Sys.Break -> MatitaLog.error "user break!"; if mode = `COMPILER then - exit ~-1 + clean_exit ~-1 else pp_ocaml_mode () | MatitaEngine.Drop -> if mode = `COMPILER then - exit 1 + clean_exit 1 else pp_ocaml_mode () | CicTextualParser2.Parse_error (floc,err) -> let (x, y) = CicAst.loc_of_floc floc in MatitaLog.error (sprintf "Parse error at %d-%d: %s" x y err); if mode = `COMPILER then - exit 1 + clean_exit 1 else pp_ocaml_mode () - + | _ -> + if mode = `COMPILER then + clean_exit 3 + else + pp_ocaml_mode ()