[gnome-builder/wip/slaf/beautifier: 18/21] beautifier plugin: check the exit status



commit d4878ab41b572630f5c0eefa42fce7be22b80556
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Mon Dec 5 21:52:29 2016 +0100

    beautifier plugin: check the exit status
    
    We show stderr on terminal only for
    an exit status != 0

 plugins/beautifier/gb-beautifier-process.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/plugins/beautifier/gb-beautifier-process.c b/plugins/beautifier/gb-beautifier-process.c
index 68a2687..184b61e 100644
--- a/plugins/beautifier/gb-beautifier-process.c
+++ b/plugins/beautifier/gb-beautifier-process.c
@@ -252,6 +252,7 @@ process_communicate_utf8_cb (GObject      *object,
   GtkTextIter begin;
   GtkTextIter end;
   ProcessState *state;
+  gboolean status;
 
   g_assert (G_IS_SUBPROCESS (process));
   g_assert (G_IS_ASYNC_RESULT (result));
@@ -294,8 +295,17 @@ process_communicate_utf8_cb (GObject      *object,
   else
     g_warning ("beautify plugin: output empty\n");
 
-  g_warning ("beautify plugin stderr:\n%s\n", stderr_str);
-
+  if (g_subprocess_get_if_exited (process))
+    {
+      status = g_subprocess_get_exit_status (process);
+      printf ("exit status:%i\n", status);
+      if (status != 0 &&
+          stderr_str != NULL &&
+          !ide_str_empty0 (stderr_str))
+        {
+          g_warning ("beautify plugin stderr:\n%s\n", stderr_str);
+        }
+    }
 }
 
 static void


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