diff --git a/src/plugins/debugger/dap/pydapengine.cpp b/src/plugins/debugger/dap/pydapengine.cpp index 01ec0f4dcd3..2257aab76ad 100644 --- a/src/plugins/debugger/dap/pydapengine.cpp +++ b/src/plugins/debugger/dap/pydapengine.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include @@ -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); diff --git a/src/plugins/debugger/dap/pydapengine.h b/src/plugins/debugger/dap/pydapengine.h index 1339c7f971a..2c5f53e63a9 100644 --- a/src/plugins/debugger/dap/pydapengine.h +++ b/src/plugins/debugger/dap/pydapengine.h @@ -27,6 +27,8 @@ private: /* Needed for Python support issue:1386 */ const QLoggingCategory &logCategory() override; + + std::unique_ptr m_installProcess; }; } // Debugger::Internal