From ca9219d447c37038063f3d297c8f8195bb23e2f1 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 3 Jan 2018 16:26:14 +0100 Subject: Remove all temporary files at program exit (#46) Replaced calls to Filename.temp_file by own version Driveraux.tmp_file. The Driveraux.tmp_file function takes care that the temporary files are removed at exit. Consequently there is no need to explicitly remove temp files in Driver. --- driver/Driveraux.ml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'driver/Driveraux.ml') diff --git a/driver/Driveraux.ml b/driver/Driveraux.ml index 2c478fb1..6d8d0adc 100644 --- a/driver/Driveraux.ml +++ b/driver/Driveraux.ml @@ -18,6 +18,11 @@ open Clflags let safe_remove file = try Sys.remove file with Sys_error _ -> () +let tmp_file suff = + let tmpfile = Filename.temp_file "compcert" suff in + at_exit (fun () -> safe_remove tmpfile); + tmpfile + (* Invocation of external tools *) let rec waitpid_no_intr pid = -- cgit