-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[rust] Use pure Rust implementation for which command #14114
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
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
PATHand 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
wherein Windows through Selenium Manager. The solution I found is to use a pure Rust crate implementing thewhichcommand. 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
whichandwherecommands with thewhichcrate to handle special characters in paths more robustly.is_executablecrate from the main dependencies as it is no longer needed.run_shell_commandfunction to improve code readability.Cargo.tomlto include thewhichcrate and movedis_executabletodev-dependencies.Changes walkthrough 📝
lib.rs
Use `which` crate for command execution and simplify logicrust/src/lib.rs
whichandwherecommand execution with thewhichcrate.
is_executablecrate usage.execute_which_in_shellfunction.shell.rs
Simplify `run_shell_command` functionrust/src/shell.rs
run_shell_commandfunction.Cargo.toml
Update dependencies in Cargo.tomlrust/Cargo.toml
whichcrate dependency.is_executablecrate todev-dependencies.