[gnome-builder/wip/chergert/pipeline: 11/48] subprocess: synthesize error when process was signaled



commit 6a9884db960c23a1f3ccd56e6ba4b0074e761745
Author: Christian Hergert <chergert redhat com>
Date:   Fri Feb 3 12:18:10 2017 -0800

    subprocess: synthesize error when process was signaled
    
    If we did not exit cleanly due to a signal, we should propagate an error
    that looks closer to what other GLib APIs will return.

 libide/subprocess/ide-subprocess.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/libide/subprocess/ide-subprocess.c b/libide/subprocess/ide-subprocess.c
index a981f08..5a90dc4 100644
--- a/libide/subprocess/ide-subprocess.c
+++ b/libide/subprocess/ide-subprocess.c
@@ -146,6 +146,18 @@ ide_subprocess_wait_check_cb (GObject      *object,
       IDE_EXIT;
     }
 
+  if (ide_subprocess_get_if_signaled (self))
+    {
+      gint term_sig = ide_subprocess_get_term_sig (self);
+
+      g_task_return_new_error (task,
+                               G_SPAWN_ERROR,
+                               G_SPAWN_ERROR_FAILED,
+                               "Child process killed by signal %d",
+                               term_sig);
+      IDE_EXIT;
+    }
+
   if (!ide_subprocess_check_exit_status (self, &error))
     {
       g_task_return_error (task, g_steal_pointer (&error));


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