diff --git a/src/libs/utils/consoleprocess.cpp b/src/libs/utils/consoleprocess.cpp index b3b7946ae5b..57f598a4763 100644 --- a/src/libs/utils/consoleprocess.cpp +++ b/src/libs/utils/consoleprocess.cpp @@ -181,7 +181,7 @@ ConsoleProcess::ConsoleProcess(QObject *parent) : ConsoleProcess::~ConsoleProcess() { - stop(); + stopProcess(); delete d; } @@ -430,10 +430,10 @@ qint64 ConsoleProcess::applicationMainThreadID() const return -1; } -bool ConsoleProcess::start() +void ConsoleProcess::start() { if (isRunning()) - return false; + return; d->m_errorString.clear(); d->m_error = QProcess::UnknownError; @@ -455,7 +455,7 @@ bool ConsoleProcess::start() const QString err = stubServerListen(); if (!err.isEmpty()) { emitError(QProcess::FailedToStart, msgCommChannelFailed(err)); - return false; + return; } QStringList env = d->m_environment.toStringList(); @@ -463,7 +463,7 @@ bool ConsoleProcess::start() d->m_tempFile = new QTemporaryFile(); if (!d->m_tempFile->open()) { cleanupAfterStartFailure(msgCannotCreateTempFile(d->m_tempFile->errorString())); - return false; + return; } QString outString; QTextStream out(&outString); @@ -493,7 +493,7 @@ bool ConsoleProcess::start() const QByteArray outBytes = textCodec ? textCodec->fromUnicode(outString) : QByteArray(); if (!textCodec || d->m_tempFile->write(outBytes) < 0) { cleanupAfterStartFailure(msgCannotWriteTempFile()); - return false; + return; } d->m_tempFile->flush(); } @@ -531,7 +531,7 @@ bool ConsoleProcess::start() const QString msg = tr("The process \"%1\" could not be started: %2") .arg(cmdLine, winErrorMessage(GetLastError())); cleanupAfterStartFailure(msg); - return false; + return; } d->processFinishedNotifier = new QWinEventNotifier(d->m_pid->hProcess, this); @@ -554,13 +554,13 @@ bool ConsoleProcess::start() } else { if (perr != ProcessArgs::FoundMeta) { emitError(QProcess::FailedToStart, tr("Quoting error in command.")); - return false; + return; } if (d->m_mode == Debug) { // FIXME: QTCREATORBUG-2809 emitError(QProcess::FailedToStart, tr("Debugging complex shell commands in a terminal" " is currently not supported.")); - return false; + return; } pcmd = qEnvironmentVariable("SHELL", "/bin/sh"); pargs = ProcessArgs::createUnixArgs( @@ -579,13 +579,13 @@ bool ConsoleProcess::start() emitError(QProcess::FailedToStart, qerr == ProcessArgs::BadQuoting ? tr("Quoting error in terminal command.") : tr("Terminal command may not be a shell command.")); - return false; + return; } const QString err = stubServerListen(); if (!err.isEmpty()) { emitError(QProcess::FailedToStart, msgCommChannelFailed(err)); - return false; + return; } d->m_environment.unset(QLatin1String("TERM")); @@ -595,7 +595,7 @@ bool ConsoleProcess::start() d->m_tempFile = new QTemporaryFile(); if (!d->m_tempFile->open()) { cleanupAfterStartFailure(msgCannotCreateTempFile(d->m_tempFile->errorString())); - return false; + return; } QByteArray contents; for (const QString &var : env) { @@ -604,7 +604,7 @@ bool ConsoleProcess::start() } if (d->m_tempFile->write(contents) != contents.size() || !d->m_tempFile->flush()) { cleanupAfterStartFailure(msgCannotWriteTempFile()); - return false; + return; } } @@ -635,16 +635,14 @@ bool ConsoleProcess::start() const QString msg = tr("Cannot start the terminal emulator \"%1\", change the setting in the " "Environment options.").arg(terminal.command); cleanupAfterStartFailure(msg); - return false; + return; } d->m_stubConnectTimer = new QTimer(this); - connect(d->m_stubConnectTimer, &QTimer::timeout, this, &ConsoleProcess::stop); + connect(d->m_stubConnectTimer, &QTimer::timeout, this, &ConsoleProcess::stopProcess); d->m_stubConnectTimer->setSingleShot(true); d->m_stubConnectTimer->start(10000); #endif - - return true; } void ConsoleProcess::cleanupAfterStartFailure(const QString &errorMessage) @@ -720,7 +718,7 @@ void ConsoleProcess::killStub() #endif } -void ConsoleProcess::stop() +void ConsoleProcess::stopProcess() { killProcess(); killStub(); diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 6fc2bad47dc..d5264ffca6e 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -81,8 +81,8 @@ public: QProcess::ProcessError error() const; QString errorString() const; - bool start(); - void stop(); + void start(); + void stopProcess(); public: void setMode(Mode m); diff --git a/src/plugins/debugger/terminal.cpp b/src/plugins/debugger/terminal.cpp index de83893a8af..027a1138626 100644 --- a/src/plugins/debugger/terminal.cpp +++ b/src/plugins/debugger/terminal.cpp @@ -224,7 +224,7 @@ void TerminalRunner::start() void TerminalRunner::stop() { - m_stubProc.stop(); + m_stubProc.stopProcess(); reportStopped(); } diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 35ca14b63a7..98fc65d4b1a 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -199,7 +199,7 @@ void ApplicationLauncherPrivate::stop() if (!isRunning()) return; if (m_useTerminal) { - m_consoleProcess.stop(); + m_consoleProcess.stopProcess(); localProcessDone(0, QProcess::CrashExit); } else { m_guiProcess.terminate(); diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp index e09f4bec72d..d22855afc9a 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp @@ -358,7 +358,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::setState(SshDeviceProcess::SshDe killOperation->disconnect(q); killOperation.clear(); if (q->runInTerminal()) - QMetaObject::invokeMethod(&consoleProcess, &ConsoleProcess::stop, Qt::QueuedConnection); + QMetaObject::invokeMethod(&consoleProcess, &ConsoleProcess::stopProcess, Qt::QueuedConnection); } killTimer.stop(); consoleProcess.disconnect();