Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(python): debugpy requires -m module #115

Merged
merged 3 commits into from
May 13, 2022

Conversation

briandealwis
Copy link
Member

Fixes #114

Ensure -mmodule arguments are transformed to -m module arguments for debugpy.

Copy link

@aaron-prindle aaron-prindle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cmdline = append(cmdline, pc.args[1:]...)
// debugpy expects the `-m` module argument to be separate
for i, arg := range pc.args[1:] {
if i == 0 && arg != "-m" && strings.HasPrefix(arg, "-m") {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why I thought i == 0 was significant but it seems fragile. And some flags, like -u for unbuffered output, seems reasonable to allow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it's because arguments after -m are no longer python arguments and are instead handed off to the program or module.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This situation is #76. I'll add a comment here and punt on it for now.

@briandealwis briandealwis merged commit 298e5e5 into GoogleContainerTools:duct-tape May 13, 2022
@briandealwis briandealwis deleted the i114 branch May 13, 2022 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python launcher does not handle -m<module>
2 participants