[gnome-builder] subprocess: only call g_subprocess_get_* APIs if not cancelled
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] subprocess: only call g_subprocess_get_* APIs if not cancelled
- Date: Mon, 20 Feb 2017 17:47:23 +0000 (UTC)
commit 6c482b5e644c5a7f300316d549b4d46e55b1e59a
Author: Christian Hergert <chergert redhat com>
Date: Mon Feb 20 09:46:17 2017 -0800
subprocess: only call g_subprocess_get_* APIs if not cancelled
Since we made our IdeSubprocess wrappers force exit processes when their
cancellable is triggered, we don't want to call these APIs unless we know
the process has exited.
We can check for this by seeing if the error is a cancelled error. It only
affects tracing builds anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=778918
libide/subprocess/ide-simple-subprocess.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/libide/subprocess/ide-simple-subprocess.c b/libide/subprocess/ide-simple-subprocess.c
index c4ef289..50452cb 100644
--- a/libide/subprocess/ide-simple-subprocess.c
+++ b/libide/subprocess/ide-simple-subprocess.c
@@ -109,16 +109,21 @@ ide_simple_subprocess_wait_cb (GObject *object,
g_assert (G_IS_SUBPROCESS (subprocess));
g_assert (G_IS_TASK (task));
+ g_subprocess_wait_finish (subprocess, result, &error);
+
#ifdef IDE_ENABLE_TRACE
- if (g_subprocess_get_if_exited (subprocess))
- IDE_TRACE_MSG ("subprocess exited with exit status: %d",
- g_subprocess_get_exit_status (subprocess));
- else
- IDE_TRACE_MSG ("subprocess exited due to signal: %d",
- g_subprocess_get_term_sig (subprocess));
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ {
+ if (g_subprocess_get_if_exited (subprocess))
+ IDE_TRACE_MSG ("subprocess exited with exit status: %d",
+ g_subprocess_get_exit_status (subprocess));
+ else
+ IDE_TRACE_MSG ("subprocess exited due to signal: %d",
+ g_subprocess_get_term_sig (subprocess));
+ }
#endif
- if (!g_subprocess_wait_finish (subprocess, result, &error))
+ if (error != NULL)
g_task_return_error (task, g_steal_pointer (&error));
else
g_task_return_boolean (task, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]