fix: skip bash syntax validation on Windows#30
Open
nuthalapativarun wants to merge 1 commit into
Open
Conversation
_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.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_validate_bash_commandinbase.pycalls/bin/bash -nto syntax-check each agent action. On Windows,/bin/bashdoes not exist, sosubprocess.runraisesFileNotFoundError. This propagates as an unhandled exception on every agent step, preventing Webwright from running on Windows at all.Fix
Guard the
subprocess.runcall withsys.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 WindowsNot affected
/bin/bash -nis still called and errors still raiseValueErrorbase.py— not touched