From 2cd88bf85309361151e3cd687596758cac256079 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Fri, 30 Oct 2026 21:08:28 +0000 Subject: [PATCH] fix: return the right exit code from `lean` on 32-bit targets Co-Authored-By: Claude Opus 5.5 --- src/util/io.h | 4 ++-- src/util/shell.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/io.h b/src/util/io.h index c648a52d1a58..d4bcde114b19 100644 --- a/src/util/io.h +++ b/src/util/io.h @@ -37,7 +37,7 @@ inline void consume_io_result(object * o) { dec(o); } -template T get_io_scalar_result(object * o) { +inline uint32 get_io_uint32_result(object * o) { if (io_result_is_error(o)) { object * err_obj = io_result_get_error(o); inc(err_obj); @@ -45,7 +45,7 @@ template T get_io_scalar_result(object * o) { string_ref error(lean_io_error_to_string(err_obj)); throw exception(error.to_std_string()); } else { - T r = unbox(io_result_get_value(o)); + uint32 r = unbox_uint32(io_result_get_value(o)); dec(o); return r; } diff --git a/src/util/shell.cpp b/src/util/shell.cpp index c44fb301e609..1bf70ae2b1a5 100644 --- a/src/util/shell.cpp +++ b/src/util/shell.cpp @@ -214,7 +214,7 @@ int run_shell_main(int argc, char* argv[], object_ref const & shell_opts) { argc--; args = list_ref(string_ref(argv[argc]), args); } - return get_io_scalar_result(lean_shell_main( + return get_io_uint32_result(lean_shell_main( args.steal(), shell_opts.to_obj_arg() )); @@ -239,7 +239,7 @@ bool process_shell_option(object_ref & shell_opts, int opt, char const * optarg, dec_ref(r); return false; } else { - rc = unbox(io_result_get_error(r)); + rc = unbox_uint32(io_result_get_error(r)); dec_ref(r); return true; }