Skip to content

fix: properly tokenize command args using shlex.split() for Windows #1440

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

Merged
merged 2 commits into from
May 27, 2025

Conversation

tsmithsz
Copy link
Contributor

@tsmithsz tsmithsz commented May 24, 2025

Problem

  1. The bashExecute tool was incorrectly handling command arguments by passing them as a single string for Windows. This caused issues with quoted arguments where commands like git commit -m "test commit" would fail due to improper argument tokenization.

  2. The validation checks for windows commands using where fails for built-in windows commands

Solution

  1. Modified the command execution to use shlex.split() with the spread operator to properly tokenize arguments
  2. Fix windows built-in command validation by using help for checking built-in commands. This reduces constant failures we saw.

Testing

  • Tested on unix and windows machine
  • Tested commands user previously reported failures for
  • Testing was also done by original windows reporters using a local build

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tsmithsz tsmithsz requested a review from a team as a code owner May 24, 2025 00:46
@tsmithsz tsmithsz changed the title fix: properly tokenize command args using shlex.split() fix: properly tokenize command args using shlex.split() for Windows May 24, 2025
@tsmithsz tsmithsz merged commit 9355003 into aws:main May 27, 2025
6 checks passed
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.

4 participants