From d362b512f4d51204e6c241c6163ea2196be7b202 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Tue, 28 Oct 2025 10:39:36 +0100 Subject: [PATCH] Misc: fix exit code of jsoo_minify and wasmoo_link_wasm --- compiler/bin-jsoo_minify/jsoo_minify.ml | 10 ++++++---- compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/compiler/bin-jsoo_minify/jsoo_minify.ml b/compiler/bin-jsoo_minify/jsoo_minify.ml index f636ab50e0..8440c703fb 100644 --- a/compiler/bin-jsoo_minify/jsoo_minify.ml +++ b/compiler/bin-jsoo_minify/jsoo_minify.ml @@ -91,7 +91,7 @@ let main = let t = Cmdliner.Term.(const f $ Cmd_arg.options) in Cmdliner.Cmd.v Cmd_arg.info t -let (_ : int) = +let (exit_code : int) = try Cmdliner.Cmd.eval ~catch:false ~argv:Sys.argv main with | (Match_failure _ | Assert_failure _ | Not_found) as exc -> let backtrace = Printexc.get_backtrace () in @@ -101,10 +101,12 @@ let (_ : int) = Sys.argv.(0); Format.eprintf "Error: %s@." (Printexc.to_string exc); prerr_string backtrace; - exit 1 + 1 | Failure s -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) s; - exit 1 + 1 | exc -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) (Printexc.to_string exc); - exit 1 + 1 + +let () = exit exit_code diff --git a/compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml b/compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml index 1192fbe17d..a04a1e40ce 100644 --- a/compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml +++ b/compiler/bin-wasm_of_ocaml/wasmoo_link_wasm.ml @@ -19,7 +19,7 @@ open Js_of_ocaml_compiler.Stdlib -let (_ : int) = +let (exit_code : int) = try Cmdliner.Cmd.eval ~catch:false ~argv:Sys.argv Link_wasm.command with | (Match_failure _ | Assert_failure _ | Not_found) as exc -> let backtrace = Printexc.get_backtrace () in @@ -29,10 +29,12 @@ let (_ : int) = Sys.argv.(0); Format.eprintf "Error: %s@." (Printexc.to_string exc); prerr_string backtrace; - exit 1 + 1 | Failure s -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) s; - exit 1 + 1 | exc -> Format.eprintf "%s: Error: %s@." Sys.argv.(0) (Printexc.to_string exc); - exit 1 + 1 + +let () = exit exit_code