From d27621b779e05471fbf65eda13cf51dc382d61b1 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Tue, 3 Jan 2023 20:37:52 -0500 Subject: [PATCH] main: catch exceptions and exit gracefully Calling 'bees -m4' should not call 'std::terminate()', but it does. Use catch_all instead. It will still pass the exit value to return from main. Signed-off-by: Zygo Blaxell --- src/bees.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bees.cc b/src/bees.cc index 6dbadf2..787ab5c 100644 --- a/src/bees.cc +++ b/src/bees.cc @@ -774,8 +774,8 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } - int rv = 1; - catch_and_explain([&]() { + int rv = EXIT_FAILURE; + catch_all([&]() { rv = bees_main(argc, argv); }); BEESLOGNOTICE("Exiting with status " << rv << " " << (rv ? "(failure)" : "(success)"));