summaryrefslogtreecommitdiff
path: root/src/plugins/python/pythonutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/python/pythonutils.cpp')
-rw-r--r--src/plugins/python/pythonutils.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp
index cd88efe8f2..713c48821e 100644
--- a/src/plugins/python/pythonutils.cpp
+++ b/src/plugins/python/pythonutils.cpp
@@ -113,17 +113,16 @@ void openPythonRepl(QObject *parent, const FilePath &file, ReplType type)
process->setCommand({pythonCommand, args});
process->setWorkingDirectory(workingDir(file));
const QString commandLine = process->commandLine().toUserOutput();
- QObject::connect(process,
- &QtcProcess::errorOccurred,
- process,
- [process, commandLine] {
- Core::MessageManager::writeDisrupting(
- QCoreApplication::translate("Python",
- "Failed to run Python (%1): \"%2\".")
- .arg(commandLine, process->errorString()));
- process->deleteLater();
- });
- QObject::connect(process, &QtcProcess::finished, process, &QObject::deleteLater);
+ QObject::connect(process, &QtcProcess::done, process, [process, commandLine] {
+ if (process->error() != QProcess::UnknownError) {
+ Core::MessageManager::writeDisrupting(QCoreApplication::translate("Python",
+ (process->error() == QProcess::FailedToStart)
+ ? "Failed to run Python (%1): \"%2\"."
+ : "Error while running Python (%1): \"%2\".")
+ .arg(commandLine, process->errorString()));
+ }
+ process->deleteLater();
+ });
process->start();
}