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

Empty arguments in launch commands are now properly escaped #25098

Closed
wants to merge 1 commit into from

Conversation

@meduzik
Copy link

meduzik commented Apr 20, 2017

Bug discovered with Python debugger extension. Usually, it passes debugOptions array to its python counterpart visualstudio_py_launcher.py from launch.json, joined with comma, like so:

launch.json:
"debugOptions": ["WaitOnAbnormalExit","WaitOnNormalExit"]

launch command:

python C:\Users....vscode\extensions\donjayamanne.python-0.6.3\pythonFiles\PythonTools\visualstudio_py_launcher.py working_dir 51686 34806ad9-833a-45248cd6-18ca4aa74f14 WaitOnAbnormalExit,WaitOnNormalExit file.py

However, when debugOptions is empty, no argument is passed. As visualstudio_py_launcher.py relies on position of its arguments, it breaks, as file.py is now taking place of debugOptions.

I tracked this issue to TerminalSupport.prepareCommand not properly escaping empty argument: it should pass "" instead of empty string for it.

With this fix, launch command for empty debugOptions looks like:

python C:\Users....vscode\extensions\donjayamanne.python-0.6.3\pythonFiles\PythonTools\visualstudio_py_launcher.py working_dir 51686 34806ad9-833a-45248cd6-18ca4aa74f14 "" file.py

and successfully works.

Tested only with cmd.exe, but in my understanding should be the same for other shells, so I changed that too.

@mention-bot

This comment has been minimized.

Copy link

mention-bot commented Apr 20, 2017

@dstep, thanks for your PR! By analyzing the history of the files in this pull request, we identified @weinand and @Tyriar to be potential reviewers.

@weinand weinand self-assigned this Apr 20, 2017
@weinand weinand added this to the April 2017 milestone Apr 20, 2017
@weinand weinand modified the milestones: May 2017, April 2017 Apr 28, 2017
@microsoft microsoft deleted a comment from msftclas Sep 26, 2017
@alexandrudima alexandrudima removed this from the May 2017 milestone Dec 12, 2017
@weinand weinand added this to the June 2019 milestone Jun 12, 2019
@weinand weinand added the debug label Jun 12, 2019
@weinand weinand closed this in fd05938 Jun 12, 2019
@weinand

This comment has been minimized.

Copy link
Member

weinand commented Jun 12, 2019

Thanks for the PR.
Since the underlying VS Code source had changed considerably in the meantime, I had to apply the changes from your PR manually. But there will be a "Thank You" in the June release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.