summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-04-16 22:00:17 -0700
committerThiago Macieira <thiago.macieira@intel.com>2018-05-02 19:43:22 +0000
commite5b5484598d97fa8fac22b8f4893d9ade370a153 (patch)
treee5c5a76dc733b3751f0a175d359179d803c05d57 /src
parent6171d647b3a060e89b2a5f3f0218288ce0ccbcac (diff)
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 <Friedemann.Kleint@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess_win.cpp7
1 files changed, 6 insertions, 1 deletions
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;