forked from qt-creator/qt-creator
ConsoleProcess: Uniform the common interface of QtcProcess
This is a preliminary step before merging ConsoleProcess into QtcProcess. Remove processError() signal, use errorOccurred() instead. Change-Id: If11064944228c82a9099fffdba942c4276690085 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -1026,7 +1026,6 @@ void ConsoleProcess::emitError(QProcess::ProcessError err, const QString &errorS
|
|||||||
d->m_error = err;
|
d->m_error = err;
|
||||||
d->m_errorString = errorString;
|
d->m_errorString = errorString;
|
||||||
emit errorOccurred(err);
|
emit errorOccurred(err);
|
||||||
emit processError(errorString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TerminalCommand::operator==(const TerminalCommand &other) const
|
bool TerminalCommand::operator==(const TerminalCommand &other) const
|
||||||
|
@@ -114,7 +114,6 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void errorOccurred(QProcess::ProcessError error);
|
void errorOccurred(QProcess::ProcessError error);
|
||||||
void processError(const QString &errorString);
|
|
||||||
|
|
||||||
// These reflect the state of the actual client process
|
// These reflect the state of the actual client process
|
||||||
void started();
|
void started();
|
||||||
|
@@ -174,7 +174,7 @@ TerminalRunner::TerminalRunner(RunControl *runControl,
|
|||||||
{
|
{
|
||||||
setId("TerminalRunner");
|
setId("TerminalRunner");
|
||||||
|
|
||||||
connect(&m_stubProc, &ConsoleProcess::processError,
|
connect(&m_stubProc, &ConsoleProcess::errorOccurred,
|
||||||
this, &TerminalRunner::stubError);
|
this, &TerminalRunner::stubError);
|
||||||
connect(&m_stubProc, &ConsoleProcess::started,
|
connect(&m_stubProc, &ConsoleProcess::started,
|
||||||
this, &TerminalRunner::stubStarted);
|
this, &TerminalRunner::stubStarted);
|
||||||
@@ -235,9 +235,9 @@ void TerminalRunner::stubStarted()
|
|||||||
reportStarted();
|
reportStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalRunner::stubError(const QString &msg)
|
void TerminalRunner::stubError()
|
||||||
{
|
{
|
||||||
reportFailure(msg);
|
reportFailure(m_stubProc.errorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -86,7 +86,7 @@ private:
|
|||||||
void stop() final;
|
void stop() final;
|
||||||
|
|
||||||
void stubStarted();
|
void stubStarted();
|
||||||
void stubError(const QString &msg);
|
void stubError();
|
||||||
|
|
||||||
Utils::ConsoleProcess m_stubProc;
|
Utils::ConsoleProcess m_stubProc;
|
||||||
std::function<ProjectExplorer::Runnable()> m_stubRunnable;
|
std::function<ProjectExplorer::Runnable()> m_stubRunnable;
|
||||||
|
@@ -77,7 +77,7 @@ public:
|
|||||||
// Local
|
// Local
|
||||||
void handleProcessStarted();
|
void handleProcessStarted();
|
||||||
void localGuiProcessError();
|
void localGuiProcessError();
|
||||||
void localConsoleProcessError(const QString &error);
|
void localConsoleProcessError();
|
||||||
void readLocalStandardOutput();
|
void readLocalStandardOutput();
|
||||||
void readLocalStandardError();
|
void readLocalStandardError();
|
||||||
void cannotRetrieveLocalDebugOutput();
|
void cannotRetrieveLocalDebugOutput();
|
||||||
@@ -151,7 +151,7 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate(ApplicationLauncher *pare
|
|||||||
|
|
||||||
connect(&m_consoleProcess, &ConsoleProcess::started,
|
connect(&m_consoleProcess, &ConsoleProcess::started,
|
||||||
this, &ApplicationLauncherPrivate::handleProcessStarted);
|
this, &ApplicationLauncherPrivate::handleProcessStarted);
|
||||||
connect(&m_consoleProcess, &ConsoleProcess::processError,
|
connect(&m_consoleProcess, &ConsoleProcess::errorOccurred,
|
||||||
this, &ApplicationLauncherPrivate::localConsoleProcessError);
|
this, &ApplicationLauncherPrivate::localConsoleProcessError);
|
||||||
connect(&m_consoleProcess, &ConsoleProcess::finished, this, [this] {
|
connect(&m_consoleProcess, &ConsoleProcess::finished, this, [this] {
|
||||||
localProcessDone(m_consoleProcess.exitCode(), m_consoleProcess.exitStatus());
|
localProcessDone(m_consoleProcess.exitCode(), m_consoleProcess.exitStatus());
|
||||||
@@ -294,9 +294,9 @@ void ApplicationLauncherPrivate::localGuiProcessError()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationLauncherPrivate::localConsoleProcessError(const QString &error)
|
void ApplicationLauncherPrivate::localConsoleProcessError()
|
||||||
{
|
{
|
||||||
emit q->appendMessage(error, ErrorMessageFormat);
|
emit q->appendMessage(m_consoleProcess.errorString(), ErrorMessageFormat);
|
||||||
if (m_processRunning && m_consoleProcess.applicationPID() == 0) {
|
if (m_processRunning && m_consoleProcess.applicationPID() == 0) {
|
||||||
m_processRunning = false;
|
m_processRunning = false;
|
||||||
emit q->processExited(-1, QProcess::NormalExit);
|
emit q->processExited(-1, QProcess::NormalExit);
|
||||||
|
@@ -113,13 +113,13 @@ void openPythonRepl(const FilePath &file, ReplType type)
|
|||||||
process->setWorkingDirectory(workingDir(file));
|
process->setWorkingDirectory(workingDir(file));
|
||||||
const QString commandLine = process->command().toUserOutput();
|
const QString commandLine = process->command().toUserOutput();
|
||||||
QObject::connect(process,
|
QObject::connect(process,
|
||||||
&ConsoleProcess::processError,
|
&ConsoleProcess::errorOccurred,
|
||||||
process,
|
process,
|
||||||
[process, commandLine](const QString &errorString) {
|
[process, commandLine] {
|
||||||
Core::MessageManager::writeDisrupting(
|
Core::MessageManager::writeDisrupting(
|
||||||
QCoreApplication::translate("Python",
|
QCoreApplication::translate("Python",
|
||||||
"Failed to run Python (%1): \"%2\".")
|
"Failed to run Python (%1): \"%2\".")
|
||||||
.arg(commandLine, errorString));
|
.arg(commandLine, process->errorString()));
|
||||||
process->deleteLater();
|
process->deleteLater();
|
||||||
});
|
});
|
||||||
QObject::connect(process, &ConsoleProcess::stubStopped, process, &QObject::deleteLater);
|
QObject::connect(process, &ConsoleProcess::stubStopped, process, &QObject::deleteLater);
|
||||||
|
Reference in New Issue
Block a user