From 3f9f5a374222eb4b95e8df72ff905a6f70b35b44 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 13 Feb 2018 18:05:48 +0000 Subject: [PATCH] Fixed temp file again --- cpdfcommand.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index b3b61a7..69e3bba 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -2314,6 +2314,7 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf = really_write_pdf ~encryption ~is_decompress mk_id pdf outname end | Stdout -> + (* FIXME Do not use a temp file if not calling cpdflin *) let temp = Filename.temp_file "cpdfstdout" ".pdf" in begin match encryption with None -> @@ -2334,7 +2335,7 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf = assert false with End_of_file -> - begin try Sys.remove temp with + begin try close_out temp_file; Sys.remove temp with e -> Printf.eprintf "Failed to remove temp file %s (%s)\n" temp (Printexc.to_string e) end; flush stdout (*r For Windows *)