Commit b9132981 authored by Andrei Paskevich's avatar Andrei Paskevich
Browse files

Autodetection: remove temporary output files

parent 52580155
...@@ -234,22 +234,21 @@ let sanitize_exec = ...@@ -234,22 +234,21 @@ let sanitize_exec =
let ask_prover_version exec_name version_switch = let ask_prover_version exec_name version_switch =
let out = Filename.temp_file "out" "" in let out = Filename.temp_file "out" "" in
let cmd = sprintf "%s %s" exec_name version_switch in let cmd = sprintf "%s %s" exec_name version_switch in
let c = sprintf "(%s) > %s 2>&1" cmd out in let c = sprintf "(%s) >%s 2>&1" cmd out in
Debug.dprintf debug "Run : %s@." c; Debug.dprintf debug "Run : %s@." c;
let ret = Sys.command c in try
if ret <> 0 then let ret = Sys.command c in
begin let ch = open_in out in
Debug.dprintf debug "command '%s' failed@." cmd; let c = Sysutil.channel_contents ch in
close_in ch;
Sys.remove out;
if ret <> 0 then begin
Debug.dprintf debug "command '%s' failed. Output:@\n%s@." cmd c;
None None
end end else Some c
else with Not_found | End_of_file | Sys_error _ ->
try Debug.dprintf debug "command '%s' failed@." cmd;
let ch = open_in out in None
let c = Sysutil.channel_contents ch in
close_in ch;
Sys.remove out;
Some c
with Not_found | End_of_file -> Some ""
let ask_prover_version env exec_name version_switch = let ask_prover_version env exec_name version_switch =
try try
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment