From f4c46647e69434142c22d41533033859f5c9f578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 16 Jan 2025 01:37:48 +0100 Subject: [PATCH] run-test: Filter out `SYSTEM_EXIT` errors Calling `System.exit()` isn't an error, and there isn't much value in logging a "Exit with code 0" message. Part-of: --- src/run-js-test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/run-js-test.c b/src/run-js-test.c index 5e56a663c..4f795252c 100644 --- a/src/run-js-test.c +++ b/src/run-js-test.c @@ -41,6 +41,7 @@ eval_module (GjsContext *js_context, const char *filename, GError **error) { + g_autoptr (GError) local_error = NULL; g_autoptr (GFile) file = NULL; g_autofree char *uri = NULL; uint8_t code; @@ -51,9 +52,10 @@ eval_module (GjsContext *js_context, if (!gjs_context_register_module (js_context, uri, uri, error)) return 1; - if (!gjs_context_eval_module (js_context, uri, &code, error)) + if (!gjs_context_eval_module (js_context, uri, &code, &local_error)) { - /* nothing, but avoid G_GNUC_WARN_UNUSED_RESULT compiler warnings */ + if (!g_error_matches (local_error, GJS_ERROR, GJS_ERROR_SYSTEM_EXIT)) + g_propagate_error (error, g_steal_pointer (&local_error)); } return code; }