From e5b5484598d97fa8fac22b8f4893d9ade370a153 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 16 Apr 2018 22:00:17 -0700 Subject: [PATCH] QProcess: set proper error state if we failed to create a pipe If the pipe creation fails, we need to properly close the pipes that were successfully created, emit the signal indicating failure and set the state back to NotRunning. The error string is reused from below, so there's no new translatable string. Task-number: QTBUG-67744 Change-Id: If90a92b041d3442fa0a4fffd1526207698f234a6 Reviewed-by: Friedemann Kleint Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_win.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 3a62a67e3b..b1ec2c560c 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -499,8 +499,13 @@ void QProcessPrivate::startProcess() if (!openChannel(stdinChannel) || !openChannel(stdoutChannel) || - !openChannel(stderrChannel)) + !openChannel(stderrChannel)) { + QString errorString = QProcess::tr("Process failed to start: %1").arg(qt_error_string()); + cleanup(); + setErrorAndEmit(QProcess::FailedToStart, errorString); + q->setProcessState(QProcess::NotRunning); return; + } const QString args = qt_create_commandline(program, arguments, nativeArguments); QByteArray envlist;