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>
bb10
Thiago Macieira 2018-04-16 22:00:17 -07:00
parent 6171d647b3
commit e5b5484598
1 changed files with 6 additions and 1 deletions

View File

@ -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;