Webwright
Webwright copied to clipboard
fix: skip bash syntax validation on Windows
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— addedimport sys; added aif sys.platform == "win32": returnguard at the top of_validate_bash_commandtests/unit/test_bash_validation.py— four new tests: valid command on POSIX, invalid syntax raisesValueErroron POSIX, validation is skipped on Windows, andsubprocess.runis never called on Windows
Not affected
- POSIX behavior — unchanged;
/bin/bash -nis still called and errors still raiseValueError - Any other function in
base.py— not touched