Skip to content

fix: skip bash syntax validation on Windows#30

Open
nuthalapativarun wants to merge 1 commit into
microsoft:mainfrom
nuthalapativarun:fix/windows-bash-validation
Open

fix: skip bash syntax validation on Windows#30
nuthalapativarun wants to merge 1 commit into
microsoft:mainfrom
nuthalapativarun:fix/windows-bash-validation

Conversation

@nuthalapativarun
Copy link
Copy Markdown

Problem

_validate_bash_command in base.py calls /bin/bash -n to syntax-check each agent action. On Windows, /bin/bash does not exist, so subprocess.run raises FileNotFoundError. This propagates as an unhandled exception on every agent step, preventing Webwright from running on Windows at all.

Fix

Guard the subprocess.run call with sys.platform == "win32" and return early. On Windows the command is passed through without syntax validation; on POSIX the existing behavior is preserved exactly.

Changes

  • src/webwright/models/base.py — added import sys; added a if sys.platform == "win32": return guard at the top of _validate_bash_command
  • tests/unit/test_bash_validation.py — four new tests: valid command on POSIX, invalid syntax raises ValueError on POSIX, validation is skipped on Windows, and subprocess.run is never called on Windows

Not affected

  • POSIX behavior — unchanged; /bin/bash -n is still called and errors still raise ValueError
  • Any other function in base.py — not touched

_validate_bash_command calls /bin/bash -n, which is absent on Windows.
This causes FileNotFoundError (or exit code 1) on every agent step,
raising FormatError for every valid command. Guard the subprocess call
with a sys.platform check and return early on win32.
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.

1 participant