fix(windows):Fixed bash, cmd, powershell, etc routing#8768
Open
burgercrisis wants to merge 15 commits intoanomalyco:devfrom
Open
fix(windows):Fixed bash, cmd, powershell, etc routing#8768burgercrisis wants to merge 15 commits intoanomalyco:devfrom
burgercrisis wants to merge 15 commits intoanomalyco:devfrom
Conversation
- Add Shell.getSpawnConfig() to route PowerShell/CMD commands directly to their executables - Implement delayed expansion for CMD commands with dynamic variables (%, %cd%, %temp%, etc.) - Fix variable corruption when commands like "cd /d %temp% && echo %cd%" execute through Git Bash - Add detection helpers: isPowerShellCommand(), isCmdCommand(), hasDynamicEnvVars() - Update BashTool to use new spawn configuration logic
- Add support for pwsh executable alongside powershell in command detection - Implement debug/verbose flag detection and preference variable injection - Add processPowerShellOutput function to improve error messages with actionable guidance - Handle common PowerShell issues: non-existent cmdlets, missing parameters, Get-Credential in non-interactive mode, debug functionality limitations - Extend timeout for Start-Job commands to prevent premature termination
… that change my github details...
…ndling - Implement special handling for CMD echo commands and commands with pipes/quotes - Add Windows-to-Unix command translation with helpful error messages - Add comprehensive PowerShell command detection and output processing - Add detailed logging for CMD command execution - Add extensive test coverage for Windows command scenarios
…rting - Extend timeout for all PowerShell job cmdlets to 10 minutes - Capture and set proper exit codes for timeout and abort scenarios - Remove problematic Get-Credential test that caused application freezing - Track exit code from process for accurate metadata reporting
… executable selection - Fix path normalization for Windows Git Bash paths by converting /c/Users/ to C:\Users\ format - Replace realpath command with Node.js path.resolve for better cross-platform compatibility - Add fallback logic for PowerShell executable selection (pwsh.exe vs powershell.exe) - Remove redundant cd command translation in Windows command mapping - Update test case to use non-existent path to verify error handling
…ogic however; this works very well but seems backwords so next commits will see if there is a truly better working solution
- Add Shell.isCmdBuiltin() function to detect CMD builtins (dir, copy, del, etc.) - Route bare CMD commands to cmd.exe instead of throwing errors - Remove Windows-to-Unix command translation layer - Update bash tool to automatically wrap detected CMD builtins - Add comprehensive test coverage for bare CMD command execution
- Enhance shell fallback logic on Windows to find bash via PATH first, then explicit flag, then Git locations - Add detailed debug logging for shell fallback, PowerShell detection, and CMD builtin checks - Improve CMD builtin detection to handle explicit "cmd /c" commands and pipes properly - Expand variable expansion in convertToDelayedExpansion to include more CMD variables - Reorder command checks to handle PowerShell before CMD builtins for better parsing
- Remove all debug console.log statements guarded by Flag.OPENCODE_DEBUG_SHELL - Clean up logging from bash path detection, PowerShell parsing, and CMD builtin checks - Maintain functional behavior while reducing noise and improving code cleanliness - This change removes verbose debug output that was only active when OPENCODE_DEBUG_SHELL was set, making the code cleaner and easier to read without affecting any runtime behavior.
…most of the tests hopefully wont be needed again, I might try to make a test file later that handles this without being quite as atomic)
…entirely so there should be no dead code remnants of the past system left refactor(cli): simplify shell command construction for non-Windows platforms - Removed manual shell detection and sidecar path resolution logic - Replaced shell command construction with direct sidecar invocation using Tauri's built-in sidecar API - Streamlined environment variable setup and argument passing - Eliminated unnecessary shell wrapper and argument formatting complexity - Improved code maintainability and reduced potential error points in CLI command creation
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
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 does this PR do?
Fixes #6488
Fixes very many issues for windows users with how it uses shells.
no cross-shell translation logic; just clean cross-platform compatible shell routing
How did you verify your code works?
Used test scripts in building to verify probably 200+ commands
Verified in app along the way with a suite of commands
% pass on my in-app test suite of 140 commands pre-fix: ~40%
% pass on my in-app test suite of 140 commands post-fix: ~100%
Merged latest stable release 1.1.23 in.
Cleaned repo.
Cleaned related dead code - get_user_shell is now redundant with my upgrades.