From dacc8cb0b2abd5ec3e9603c9bcf5b8f489639404 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@nokia.com>
Date: Fri, 22 May 2009 18:14:34 +0200
Subject: Reorganise the pipe creation code.

Put all pipe creation calls together.

Reviewed-by: Oswald Buddenhagen
---
 src/corelib/io/qprocess_unix.cpp | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index b06e217..e87c314 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -580,29 +580,27 @@ void QProcessPrivate::startProcess()
     processManager()->start();
 
     // Initialize pipes
+    if (!createChannel(stdinChannel) ||
+        !createChannel(stdoutChannel) ||
+        !createChannel(stderrChannel))
+        return;
     qt_create_pipe(childStartedPipe);
+    qt_create_pipe(deathPipe);
+    ::fcntl(deathPipe[0], F_SETFD, FD_CLOEXEC);
+    ::fcntl(deathPipe[1], F_SETFD, FD_CLOEXEC);
+
     if (threadData->eventDispatcher) {
         startupSocketNotifier = new QSocketNotifier(childStartedPipe[0],
                                                     QSocketNotifier::Read, q);
         QObject::connect(startupSocketNotifier, SIGNAL(activated(int)),
                          q, SLOT(_q_startupNotification()));
-    }
 
-    qt_create_pipe(deathPipe);
-    ::fcntl(deathPipe[0], F_SETFD, FD_CLOEXEC);
-    ::fcntl(deathPipe[1], F_SETFD, FD_CLOEXEC);
-    if (threadData->eventDispatcher) {
         deathNotifier = new QSocketNotifier(deathPipe[0],
                                             QSocketNotifier::Read, q);
         QObject::connect(deathNotifier, SIGNAL(activated(int)),
                          q, SLOT(_q_processDied()));
     }
 
-    if (!createChannel(stdinChannel) ||
-        !createChannel(stdoutChannel) ||
-        !createChannel(stderrChannel))
-        return;
-
     // Start the process (platform dependent)
     q->setProcessState(QProcess::Starting);
 
-- 
cgit v0.12