Webwright icon indicating copy to clipboard operation
Webwright copied to clipboard

fix: skip bash syntax validation on Windows

Open nuthalapativarun opened this issue 6 months ago • 0 comments

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

nuthalapativarun avatar May 29 '26 06:05 nuthalapativarun