FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Avoid shell parsing for Python helper commands by StantonMatt · Pull Request #327 · extrabacon/python-shell · GitHub

Repository navigation

Avoid shell parsing for Python helper commands - #327

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

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

Conversation

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>

PNHD left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Reviewed current head 0208d08 with the shell-execution boundary in mind.

Passing the Python executable and arguments separately through execFile/execFileSync fixes the path-with-spaces bug from #181 and removes shell interpretation from checkSyntaxFile(), getVersion(), and getVersionSync() without changing their observable stdout/stderr contracts.

The focused regressions cover both spaced script paths and spaced executable paths. LGTM.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

2 participants


Back | FazBrowse Home | New Git URL