-
Notifications
You must be signed in to change notification settings - Fork 6.4k
fix(windows) shell_command on windows, minor parsing #6811
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
|
|
||
| /// Extracts the shell and script from a command, regardless of platform | ||
| pub fn extract_shell_command(command: &[String]) -> Option<(&str, &str)> { | ||
| extract_bash_command(command).or_else(|| extract_powershell_command(command)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted in the PR description, I don't feel strongly about prioritizing cross-platform shell support in this PR. If we want to keep things simple, we can branch here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| stage: Stage::Experimental, | ||
| default_enabled: false, | ||
| default_enabled: cfg!(windows), | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update default tools tests for Windows
Because this now evaluates to true when the binary is built for Windows, Features::with_defaults() will enable ShellCommandTool by default on that platform. The spec tests in codex-rs/core/src/tools/spec.rs (test_build_specs_gpt5_codex_default, test_build_specs_gpt51_codex_default, test_model_tools_gpt5_codex_default, etc.) still assert that the default tool list contains "shell", so on Windows they now observe "shell_command" instead and the assert_eq! calls fail. Please update those expectations (e.g. branch on cfg!(windows)) so the test suite passes on Windows.
Useful? React with 👍 / 👎.
af19be3 to
3f891f2
Compare
Summary
Enables shell_command for windows users, and starts adding some basic command parsing here, to at least remove powershell prefixes. We'll follow this up with command parsing but I wanted to land this change separately with some basic UX.
NOTE: This implementation parses bash and powershell on both platforms. In theory this is possible, since you can use git bash on windows or powershell on linux. In practice, this may not be worth the complexity of supporting, so I don't feel strongly about the current approach vs. platform-specific branching.
Testing