forked from qt-creator/qt-creator
PyDapEngine: Start install process directly from the main thread
There is no need to start it from a separate thread. Change-Id: I0f560345ed0f02832176a8986a9fbdd97061d3ae Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
#include <debugger/debuggermainwindow.h>
|
||||
#include <debugger/debuggertr.h>
|
||||
|
||||
#include <utils/async.h>
|
||||
#include <utils/infobar.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
@@ -200,16 +199,6 @@ void PyDapEngine::quitDebugger()
|
||||
DebuggerEngine::quitDebugger();
|
||||
}
|
||||
|
||||
void installDebugpyPackage(const FilePath &pythonPath)
|
||||
{
|
||||
CommandLine cmd{pythonPath, {"-m", "pip", "install", "debugpy"}};
|
||||
Process process;
|
||||
process.setCommand(cmd);
|
||||
process.setTerminalMode(TerminalMode::Run);
|
||||
process.start();
|
||||
process.waitForFinished();
|
||||
}
|
||||
|
||||
bool PyDapEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
|
||||
{
|
||||
return bp.fileName.endsWith(".py");
|
||||
@@ -269,9 +258,11 @@ void PyDapEngine::setupEngine()
|
||||
info.addCustomButton(Tr::tr("Install debugpy"), [this] {
|
||||
Core::ICore::infoBar()->removeInfo(installDebugPyInfoBarId);
|
||||
Core::ICore::infoBar()->globallySuppressInfo(installDebugPyInfoBarId);
|
||||
QTimer::singleShot(0, this, [interpreter = runParameters().interpreter] {
|
||||
Utils::asyncRun(&installDebugpyPackage, interpreter);
|
||||
});
|
||||
m_installProcess.reset(new Process);
|
||||
m_installProcess->setCommand({runParameters().interpreter,
|
||||
{"-m", "pip", "install", "debugpy"}});
|
||||
m_installProcess->setTerminalMode(TerminalMode::Run);
|
||||
m_installProcess->start();
|
||||
});
|
||||
Core::ICore::infoBar()->addInfo(info);
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ private:
|
||||
/* Needed for Python support issue:1386 */
|
||||
|
||||
const QLoggingCategory &logCategory() override;
|
||||
|
||||
std::unique_ptr<Utils::Process> m_installProcess;
|
||||
};
|
||||
|
||||
} // Debugger::Internal
|
||||
|
||||
Reference in New Issue
Block a user