[gnome-builder] subprocess: prefer g_unix_open_pipe() over pipe2()



commit b980add939bbdd9e7fbe5610e209d102846dacc0
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 5 14:49:32 2016 -0700

    subprocess: prefer g_unix_open_pipe() over pipe2()
    
    pipe2() is apparently not available for us on Mac OS X. While
    that is not a major target for us, if it's easy to support we
    might as well do it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772279

 libide/subprocess/ide-breakout-subprocess.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/libide/subprocess/ide-breakout-subprocess.c b/libide/subprocess/ide-breakout-subprocess.c
index 5a1a0ea..2056959 100644
--- a/libide/subprocess/ide-breakout-subprocess.c
+++ b/libide/subprocess/ide-breakout-subprocess.c
@@ -1203,11 +1203,8 @@ ide_breakout_subprocess_initable_init (GInitable     *initable,
     }
   else if (self->flags & G_SUBPROCESS_FLAGS_STDIN_PIPE)
     {
-      if (pipe2 (stdin_pair, O_CLOEXEC) != 0)
-        {
-          set_error_from_errno (error);
-          IDE_GOTO (cleanup_fds);
-        }
+      if (!g_unix_open_pipe (stdin_pair, O_CLOEXEC, error))
+        IDE_GOTO (cleanup_fds);
     }
   else
     {
@@ -1248,11 +1245,8 @@ ide_breakout_subprocess_initable_init (GInitable     *initable,
     }
   else if (self->flags & G_SUBPROCESS_FLAGS_STDOUT_PIPE)
     {
-      if (pipe2 (stdout_pair, O_CLOEXEC) != 0)
-        {
-          set_error_from_errno (error);
-          IDE_GOTO (cleanup_fds);
-        }
+      if (!g_unix_open_pipe (stdout_pair, O_CLOEXEC, error))
+        IDE_GOTO (cleanup_fds);
     }
   else
     {
@@ -1291,11 +1285,8 @@ ide_breakout_subprocess_initable_init (GInitable     *initable,
     }
   else if (self->flags & G_SUBPROCESS_FLAGS_STDERR_PIPE)
     {
-      if (pipe2 (stderr_pair, O_CLOEXEC) != 0)
-        {
-          set_error_from_errno (error);
-          IDE_GOTO (cleanup_fds);
-        }
+      if (!g_unix_open_pipe (stderr_pair, O_CLOEXEC, error))
+        IDE_GOTO (cleanup_fds);
     }
   else
     {


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