fix windows PATHEXT resolution for .cmd/.bat wrappers#269
Open
F0rty-Tw0 wants to merge 34 commits intortk-ai:masterfrom
Open
fix windows PATHEXT resolution for .cmd/.bat wrappers#269F0rty-Tw0 wants to merge 34 commits intortk-ai:masterfrom
F0rty-Tw0 wants to merge 34 commits intortk-ai:masterfrom
Conversation
Collaborator
|
Hi, this PR has conflicts with master. Could you rebase on current master? Thanks! |
- Add `which` and `env_home` packages to dependencies. - Update `Cargo.lock` with new package versions.
- Introduce `resolve_binary` to find binaries on PATH, honoring PATHEXT. - Implement `resolved_command` for creating commands with proper binary resolution. - Add `tool_exists` function to check for tool availability on PATH. This change improves command execution reliability on Windows systems.
Use `resolved_command` for executing `wget` to improve command resolution and error handling.
Use `resolved_command` utility to create the command for `wc`, improving command resolution consistency across platforms.
- Update command resolution to use `resolved_command` for better compatibility. - Simplify tool existence check by using `tool_exists` function.
Use `resolved_command` to check for the `tree` command instead of using `Command::new("which")`. This simplifies the command resolution process and ensures consistency across the codebase.
Updated the command execution to use `resolved_command` for better compatibility and resolution of command paths.
- Updated command execution to use `resolved_command` for better resolution of command paths. - Removed the `which_command` function as it is no longer needed.
- Updated `create_prisma_command` to use `resolved_command` for better tool resolution. - Removed unnecessary checks for `prisma` existence.
Refactor command execution to use `resolved_command` for better compatibility and error handling. - Updated `run_list`, `run_outdated`, `run_install`, and `run_passthrough` functions to utilize `resolved_command`.
- Update command initialization to use `resolved_command` for better package manager detection.
- Update command execution to use `resolved_command` for better consistency. - Remove the obsolete `which_command` function.
Updated function documentation to provide English descriptions for better understanding and consistency across the codebase.
Refactor the `create_prisma_command` function to use the imported `Command` type directly for improved clarity and consistency.
- Updated the command execution logic to use `resolved_command` for better resolution of command paths. - Simplified the existence check for the `next` tool.
- Update Python linter command execution to use `resolved_command`, which honors PATHEXT on Windows for `.CMD/.BAT` wrappers.
Refactor the command execution in `run` function to use `resolved_command` for better consistency and error handling.
- Updated `rg_cmd` to use `resolved_command("rg")`.
- Updated fallback to use `resolved_command("grep")`.
- Update command execution to use `resolved_command` for consistency across formatters.
Updated the command initialization to use `resolved_command` for better consistency across the codebase.
Updated the `curl_cmd` to utilize `resolved_command` for command execution, enhancing consistency across command wrappers.
Updated the command execution to use `resolved_command` for better handling of command paths and execution context.
Refactor `kubectl` command invocations to use `resolved_command` for improved command resolution.
Refactor command execution to utilize `resolved_command` for better handling of command paths and existence checks.
- Documented the fix for spawning .CMD/.BAT/.PS1 wrappers on Windows. - Explained the root cause and solution for the issue. - Listed affected command modules and added testing details.
Add section addressing "program not found" errors for Node.js tools on Windows. Explain root cause related to PATHEXT and provide solutions for upgrading and verifying installation. * Introduced `resolved_command()` for better command resolution. * Added workaround for users on older versions.
- Bump version in `Cargo.toml`, `CHANGELOG.md`, and documentation files. - Ensure consistency across project files for the new release.
de135a4 to
a5eea5a
Compare
- Correct `rtk` version in README from `0.22.3` to `0.22.2`. - Improve formatting of tables and sections for clarity. - Add troubleshooting steps for common installation issues. - Clarify the distinction between `Rust Token Killer` and `Rust Type Kit`. - Update installation instructions and verification steps. - Ensure consistency in command examples and outputs.
… support
New upstream mypy_cmd.rs (0.23.0) used Command::new("mypy"),
Command::new("python3"), and a custom which_command() helper — all
of which fail on Windows .CMD/.BAT wrappers. Migrate to
resolved_command() and tool_exists() from utils.rs.
Restore CHANGELOG.md, CLAUDE.md, README.md, ARCHITECTURE.md, docs/TROUBLESHOOTING.md, and .gitignore to upstream/master state. This PR should only contain the PATHEXT resolution code changes.
Added `.omc` to the `.gitignore` file to prevent tracking of this file in the repository.
Author
Should be done, plus updated the new commands with the utils. |
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.
What changed
whichcrate to resolve binary paths with proper PATH+PATHEXT handling before spawningresolve_binary(),resolved_command(), andtool_exists()helpers insrc/utils.rsCommand::new(...)withresolved_command(...)across all 16+ command modules (vitest, eslint, tsc, pnpm, playwright, prisma, next, pip, pytest, ruff, golangci-lint, etc.)which_command()/tool_exists()helpers from individual modules (pip_cmd.rs, pytest_cmd.rs, ccusage.rs)Impact on existing code
resolved_command()instead of rawCommand::new(). On non-Windows this resolves to the same binary path, so behavior is unchanged. On Windows, .CMD/.BAT/.PS1 shims installed by npm/pnpm are now found correctly.whichcrate adds three small transitive dependencies (env_home, winsafe, rustix — rustix was already present).which_command()helpers (pip, pytest, ccusage) now use the sharedtool_exists()from utils, removing ~40 lines of duplicated code.Test plan
rtk vitest run,rtk lint src/,rtk tscwith Node.js tools installed via pnpm/npm — should no longer fail with "program not found"cargo test --allto confirm no regressionsresolve_binary("cargo")returns a valid path in CI across all platformsCloses #212