[gjs/esm/static-imports: 50/52] Cleanup console.




commit 659c28c99cd6b10c271933021477e341085b8046
Author: Evan Welsh <contact evanwelsh com>
Date:   Thu Jan 28 17:54:53 2021 -0800

    Cleanup console.

 gjs/console.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gjs/console.cpp b/gjs/console.cpp
index 511496e0..12e6139e 100644
--- a/gjs/console.cpp
+++ b/gjs/console.cpp
@@ -181,15 +181,17 @@ int define_argv_and_eval_script(GjsContext* js_context, int argc,
         GjsAutoUnref<GFile> output = g_file_new_for_commandline_arg(filename);
         GjsAutoChar uri = g_file_get_uri(output);
         if (!gjs_context_register_module(js_context, uri, uri, &error)) {
-            g_printerr("%s\n", error->message);
+            g_critical("%s", error->message);
             code = 1;
         }
 
-        uint8_t code_8 = 0;
-        if (!gjs_context_eval_module(js_context, uri, &code_8, &error)) {
-            code = code_8;
+        uint8_t code_u8 = 0;
+        if (!gjs_context_eval_module(js_context, uri, &code_u8, &error)) {
+            code = code_u8;
+
             if (!g_error_matches(error, GJS_ERROR, GJS_ERROR_SYSTEM_EXIT))
                 g_critical("%s", error->message);
+            g_clear_error(&error);
         }
     } else if (!gjs_context_eval(js_context, script, len, filename, &code,
                                  &error)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]