make the #use_output directive compatible with ocaml >= 4.02
This commit is contained in:
parent
3f735497d9
commit
692b92794d
|
@ -748,9 +748,16 @@ let () =
|
||||||
+-----------------------------------------------------------------+ *)
|
+-----------------------------------------------------------------+ *)
|
||||||
|
|
||||||
|
|
||||||
|
let try_finally ~always work=
|
||||||
|
#if OCAML_VERSION >= (4, 08, 0)
|
||||||
|
Misc.try_finally ~always work
|
||||||
|
#else
|
||||||
|
Misc.try_finally work always
|
||||||
|
#endif
|
||||||
|
|
||||||
let use_output command =
|
let use_output command =
|
||||||
let fn = Filename.temp_file "ocaml" "_toploop.ml" in
|
let fn = Filename.temp_file "ocaml" "_toploop.ml" in
|
||||||
Misc.try_finally ~always:(fun () ->
|
try_finally ~always:(fun () ->
|
||||||
try Sys.remove fn with Sys_error _ -> ())
|
try Sys.remove fn with Sys_error _ -> ())
|
||||||
(fun () ->
|
(fun () ->
|
||||||
match
|
match
|
||||||
|
|
Loading…
Reference in New Issue