[gnome-builder] ide: don't try to steal stream data if it failed to close



commit 0a9fb7999586c091e3856fd9221496e35957c3e0
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Wed Dec 28 13:33:31 2016 -0800

    ide: don't try to steal stream data if it failed to close
    
    When the subprocess stream fails to close, don't steal its data; the
    stream must be closed for that to succeed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779976

 libide/subprocess/ide-breakout-subprocess.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/libide/subprocess/ide-breakout-subprocess.c b/libide/subprocess/ide-breakout-subprocess.c
index d8130c2..1cf451c 100644
--- a/libide/subprocess/ide-breakout-subprocess.c
+++ b/libide/subprocess/ide-breakout-subprocess.c
@@ -367,8 +367,17 @@ communicate_result_validate_utf8 (const char            *stream_name,
   if (buffer)
     {
       const char *end;
+      GError *local_error = NULL;
+
       if (!g_output_stream_is_closed (G_OUTPUT_STREAM (buffer)))
-        g_output_stream_close (G_OUTPUT_STREAM (buffer), NULL, NULL);
+        g_output_stream_close (G_OUTPUT_STREAM (buffer), NULL, &local_error);
+
+      if (local_error != NULL)
+        {
+          g_propagate_error (error, local_error);
+          IDE_RETURN (FALSE);
+        }
+
       *return_location = g_memory_output_stream_steal_data (buffer);
       if (!g_utf8_validate (*return_location, -1, &end))
         {


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