Skip to content

Avoid shell parsing for Python helper commands#327

Open
StantonMatt wants to merge 1 commit into
extrabacon:masterfrom
StantonMatt:fix-python-path-spaces
Open

Avoid shell parsing for Python helper commands#327
StantonMatt wants to merge 1 commit into
extrabacon:masterfrom
StantonMatt:fix-python-path-spaces

Conversation

@StantonMatt
Copy link
Copy Markdown

Summary

  • replace shell-string execution in checkSyntaxFile, getVersion, and getVersionSync with argument-vector execFile calls
  • fix paths with spaces for explicit Python executable paths and syntax-checked file paths
  • add regressions for getVersion(), getVersionSync(), and checkSyntaxFile() paths containing spaces

Fixes #181.

Why

The previous implementation built commands like ${pythonPath} --version. That breaks when the Python executable path contains spaces and also leaves these helpers dependent on shell parsing. Passing the executable and arguments separately avoids quoting issues.

Verification

  • npm test -- --grep "path contains spaces|executable path contains spaces"
  • npm test
  • npx prettier --check index.ts test/test-python-shell.ts
  • git diff --check
  • review-fix-loop: clean, no introduced correctness/security/maintainability issues

Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
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.

checkVersion fails when path has space

1 participant