Skip to content

Wrap arguments in quotes when spawning custom integrations on Windows#19237

Merged
sergiou87 merged 2 commits intodevelopmentfrom
fix-spawn-integration-windows
Sep 12, 2024
Merged

Wrap arguments in quotes when spawning custom integrations on Windows#19237
sergiou87 merged 2 commits intodevelopmentfrom
fix-spawn-integration-windows

Conversation

@sergiou87
Copy link
Member

Closes #19218

Description

After the changes in #19224 , the quotes entered by the user are preserved until the very last moment, right before spawning the custom shell/editor, when the list of arguments is parsed into an array of strings.

When this happens, the strings in this array don't have quotes added by the user. For example:
-p "Git Bash" -d %TARGET_PATH"
is converted to
['-p', 'Git Bash', '-d', '%TARGET_PATH']

This is the expected behavior, however spawn behavior when shell: true option is present will make the spawned process to receive the parameters as if they were split by spaces again:
['-p', 'Git', 'Bash', '-d', '%TARGET_PATH']
Which is wrong...

This PR adds a "safe" wrapper around spawn that adds the quotes to every parameter (and to the command) on Windows when shell: true is present.

Release notes

Notes: [Fixed] Arguments with spaces are passed correctly to custom editors or shells on Windows

Copy link
Contributor

@tidy-dev tidy-dev left a comment

Choose a reason for hiding this comment

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

@sergiou87 sergiou87 merged commit c2cc76e into development Sep 12, 2024
@sergiou87 sergiou87 deleted the fix-spawn-integration-windows branch September 12, 2024 09:18
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.

The new integrations feature removes quotes

2 participants