Skip to content

Fix the upcoming problem with bash.exe being deprecated#8

Open
cerebrate wants to merge 5 commits intoneosmart:masterfrom
arkane-systems:master
Open

Fix the upcoming problem with bash.exe being deprecated#8
cerebrate wants to merge 5 commits intoneosmart:masterfrom
arkane-systems:master

Conversation

@cerebrate
Copy link

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.)

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.
Copilot AI review requested due to automatic review settings March 6, 2026 22:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.exe to wsl.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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants