forked from qt-creator/qt-creator
PythonUtils: Use QtcProcess in terminal mode instead of ConsoleProcess
Change-Id: Icd8a481a03a2a13f5556327ce5caf661a5d19321 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -36,8 +36,8 @@
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/consoleprocess.h>
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
@@ -107,13 +107,13 @@ void openPythonRepl(QObject *parent, const FilePath &file, ReplType type)
|
||||
};
|
||||
|
||||
const auto args = QStringList{"-i"} + replImportArgs(file, type);
|
||||
auto process = new ConsoleProcess(parent);
|
||||
auto process = new QtcProcess(QtcProcess::TerminalOn, parent);
|
||||
const FilePath pythonCommand = detectPython(file);
|
||||
process->setCommand({pythonCommand, args});
|
||||
process->setWorkingDirectory(workingDir(file));
|
||||
const QString commandLine = process->commandLine().toUserOutput();
|
||||
QObject::connect(process,
|
||||
&ConsoleProcess::errorOccurred,
|
||||
&QtcProcess::errorOccurred,
|
||||
process,
|
||||
[process, commandLine] {
|
||||
Core::MessageManager::writeDisrupting(
|
||||
@@ -122,7 +122,7 @@ void openPythonRepl(QObject *parent, const FilePath &file, ReplType type)
|
||||
.arg(commandLine, process->errorString()));
|
||||
process->deleteLater();
|
||||
});
|
||||
QObject::connect(process, &ConsoleProcess::finished, process, &QObject::deleteLater);
|
||||
QObject::connect(process, &QtcProcess::finished, process, &QObject::deleteLater);
|
||||
process->start();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user