-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rust] Use pure Rust implementation for which command #14114
Conversation
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
CI Failure Feedback 🧐
✨ CI feedback usage guide:The CI feedback tool (
In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:
where Configuration options
See more information about the |
* [rust] Use pure Rust implementation for which command * [rust] Temporal disable of windows worker to run tests in CI * Revert "[rust] Temporal disable of windows worker to run tests in CI" This reverts commit 1b88d56.
User description
Description
This PR includes the use of the which crate in Selenium Manager.
As reported in #14066, when a driver is found in the
PATH
and the path of that driver contains special characters (e.g., Japanese), SM is unable to parse the full path of the driver, giving an error in response.After much digging into this issue, I have found that it is caused by the execution of the command
where
in Windows through Selenium Manager. The solution I found is to use a pure Rust crate implementing thewhich
command. This should work both in Windows, Linux, and macOS.Thanks to adding this crate, another existing crate (called
is_executable
) is not required anymore. So, the size of the resulting SM binaries does not change.Motivation and Context
Fix for #14066.
Types of changes
Checklist
PR Type
Bug fix, Enhancement
Description
which
andwhere
commands with thewhich
crate to handle special characters in paths more robustly.is_executable
crate from the main dependencies as it is no longer needed.run_shell_command
function to improve code readability.Cargo.toml
to include thewhich
crate and movedis_executable
todev-dependencies
.Changes walkthrough 📝
lib.rs
Use `which` crate for command execution and simplify logic
rust/src/lib.rs
which
andwhere
command execution with thewhich
crate.
is_executable
crate usage.execute_which_in_shell
function.shell.rs
Simplify `run_shell_command` function
rust/src/shell.rs
run_shell_command
function.Cargo.toml
Update dependencies in Cargo.toml
rust/Cargo.toml
which
crate dependency.is_executable
crate todev-dependencies
.