forked from qt-creator/qt-creator
PythonUtils: Connect to QtcProcess::done() signal
Instead of connecting to errorOccurred() and finished() signals. Change-Id: I02fefe01cfc4be6ef996c7c8b98b36137217504e Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -113,17 +113,16 @@ void openPythonRepl(QObject *parent, const FilePath &file, ReplType type)
|
|||||||
process->setCommand({pythonCommand, args});
|
process->setCommand({pythonCommand, args});
|
||||||
process->setWorkingDirectory(workingDir(file));
|
process->setWorkingDirectory(workingDir(file));
|
||||||
const QString commandLine = process->commandLine().toUserOutput();
|
const QString commandLine = process->commandLine().toUserOutput();
|
||||||
QObject::connect(process,
|
QObject::connect(process, &QtcProcess::done, process, [process, commandLine] {
|
||||||
&QtcProcess::errorOccurred,
|
if (process->error() != QProcess::UnknownError) {
|
||||||
process,
|
Core::MessageManager::writeDisrupting(QCoreApplication::translate("Python",
|
||||||
[process, commandLine] {
|
(process->error() == QProcess::FailedToStart)
|
||||||
Core::MessageManager::writeDisrupting(
|
? "Failed to run Python (%1): \"%2\"."
|
||||||
QCoreApplication::translate("Python",
|
: "Error while running Python (%1): \"%2\".")
|
||||||
"Failed to run Python (%1): \"%2\".")
|
.arg(commandLine, process->errorString()));
|
||||||
.arg(commandLine, process->errorString()));
|
}
|
||||||
process->deleteLater();
|
process->deleteLater();
|
||||||
});
|
});
|
||||||
QObject::connect(process, &QtcProcess::finished, process, &QObject::deleteLater);
|
|
||||||
process->start();
|
process->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user