MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / start_debugpy

Function start_debugpy

src/python/runner.cpp:780–808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

778 }
779
780 bool start_debugpy(const int port) {
781 ensure_initialized();
782
783 auto& pm = PackageManager::instance();
784 if (!pm.is_installed("debugpy")) {
785 LOG_INFO("Installing debugpy...");
786 const auto result = pm.install("debugpy");
787 if (!result.success) {
788 LOG_ERROR("Failed to install debugpy: {}", result.error);
789 return false;
790 }
791 update_python_path();
792 }
793
794 int rc;
795 {
796 const GilAcquire gil;
797 const std::string code = std::format("import debugpy; debugpy.listen(('0.0.0.0', {}))", port);
798 rc = PyRun_SimpleString(code.c_str());
799 }
800
801 if (rc != 0) {
802 LOG_ERROR("Failed to start debugpy on port {}", port);
803 return false;
804 }
805
806 LOG_INFO("debugpy listening on port {}", port);
807 return true;
808 }
809
810 void join_plugin_preload() {
811 if (g_plugin_preload_thread.thread.joinable()) {

Callers 1

mainFunction · 0.85

Calls 7

ensure_initializedFunction · 0.85
instanceFunction · 0.85
update_python_pathFunction · 0.85
formatFunction · 0.85
is_installedMethod · 0.80
c_strMethod · 0.80
installMethod · 0.45

Tested by

no test coverage detected