Skip to content

Commit 27b9130

Browse files
authored
Detect if image is configured to use pydevd (#72)
1 parent d9910bc commit 27b9130

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

python/helper-image/launcher/launcher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ func (pc *pythonContext) alreadyConfigured() bool {
173173
logrus.Debug("already configured to use ptvsd")
174174
return true
175175
}
176+
if (pc.args[1] == "-m" && len(pc.args) > 2 && pc.args[2] == "pydevd") || pc.args[1] == "-mpydevd" {
177+
logrus.Debug("already configured to use pydevd")
178+
return true
179+
}
176180
}
177181
return false
178182
}

python/helper-image/launcher/launcher_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ func TestAlreadyConfigured(t *testing.T) {
112112
{"python with app module 2", pythonContext{args: []string{"python", "-m", "app"}}, false},
113113
{"configured for pydevd", pythonContext{args: []string{"pydevd", "--server", "app"}}, true},
114114
{"configured for pydevd", pythonContext{args: []string{"/dbg/pydevd/bin/pydevd", "--server", "app"}}, true},
115+
{"configured for pydevd", pythonContext{args: []string{"python", "-mpydevd", "--server", "app"}}, true},
116+
{"configured for pydevd", pythonContext{args: []string{"python3.8", "-m", "pydevd", "--server", "app"}}, true},
115117
{"python with debugpy module", pythonContext{args: []string{"python", "-mdebugpy"}}, true},
116118
{"versioned python with debugpy module", pythonContext{args: []string{"/usr/bin/python3.9", "-m", "debugpy"}}, true},
117119
{"python with ptvsd module", pythonContext{args: []string{"python", "-mptvsd"}}, true},

0 commit comments

Comments
 (0)