Fix the upcoming problem with bash.exe being deprecated#8
Open
cerebrate wants to merge 5 commits intoneosmart:masterfrom
Open
Fix the upcoming problem with bash.exe being deprecated#8cerebrate wants to merge 5 commits intoneosmart:masterfrom
cerebrate wants to merge 5 commits intoneosmart:masterfrom
Conversation
Refactor Escape to use size_t for buffer sizing and check for allocation failures. Switch lpArg allocation from alloca to calloc, add error handling for allocation failures, and ensure all allocated memory is freed in all code paths. Add _Analysis_assume_ annotations for static analysis. Close process thread handle immediately after creation. These changes enhance robustness and prevent memory leaks.
There was a problem hiding this comment.
Pull request overview
This PR updates the RunInBash utility to avoid reliance on the deprecated bash.exe shim on newer Windows 11 builds by launching commands via %windir%\system32\wsl.exe instead, while also addressing some warnings/cleanup.
Changes:
- Switch process launch from
bash.exetowsl.exe(and update help/README messaging accordingly). - Improve argument handling, escaping, and memory allocation/error handling in
RunInBash.cpp. - Update Visual Studio project settings (Windows SDK targeting and toolset).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| RunInBash/RunInBash.vcxproj | Updates Windows SDK targeting and MSVC toolset selection. |
| RunInBash/RunInBash.cpp | Uses wsl.exe instead of bash.exe, adjusts flag parsing, and improves allocation/error handling. |
| README.md | Updates description to reflect wsl.exe usage. |
| .github/copilot-instructions.md | Adds repo-specific Copilot guidance aligned with the new wsl.exe flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This PR is to fix an issue that is currently only evident when using the canary/dev releases of Windows 11. Currently on, for example, build 22620 the bash.exe shim has been removed from
system32, as a test run for removing it in forthcoming Windows releases. This obviously breaks RunInBash.The PR alters RunInBash to use wsl.exe rather than bash.exe to operate, avoiding this issue.
(While I was in there, I took a moment to resolve some warnings while I was at it, but there are no other functional changes.)