try very hard to remove temporary files generated by Nitpick in case of interruption
--- a/src/HOL/Tools/Nitpick/kodkod.ML Thu Oct 29 21:57:59 2009 +0100
+++ b/src/HOL/Tools/Nitpick/kodkod.ML Thu Oct 29 22:31:30 2009 +0100
@@ -1027,12 +1027,10 @@
val err_path = path_for "kodkodi" "err"
val _ = write_problem_file out (map snd indexed_problems)
val _ = File.write_buffer in_path (!in_buf)
- (* (int list -> outcome) -> outcome *)
- fun stopped constr =
- let val nontriv_js = map reindex (snd (read_output_file out_path)) in
- constr (triv_js @ nontriv_js)
- handle Exn.Interrupt => Interrupted NONE
- end
+ (* unit -> unit *)
+ fun remove_temporary_files () =
+ if overlord then ()
+ else List.app File.rm [in_path, out_path, err_path]
in
let
val ms =
@@ -1085,12 +1083,16 @@
else
Normal (ps, js)
end
- in
- if overlord then ()
- else List.app File.rm [in_path, out_path, err_path];
- outcome
- end
- handle Exn.Interrupt => stopped (Interrupted o SOME)
+ in remove_temporary_files (); outcome end
+ handle Exn.Interrupt =>
+ let
+ val nontriv_js = map reindex (snd (read_output_file out_path))
+ in
+ (remove_temporary_files ();
+ Interrupted (SOME (triv_js @ nontriv_js)))
+ handle Exn.Interrupt =>
+ (remove_temporary_files (); Interrupted NONE)
+ end
end
end