Repository navigation
fix(shim): create niu.exe with CREATE_NO_WINDOW when stdio is piped (niubash#379) - #668
Merged
Merged
Conversation
…niubash#379) A GUI parent with no console of its own (Claude Code spawning the bash.exe shim with piped stdio) makes Windows allocate a visible console for the niu.exe child: one black flash per invocation. The shim forwarded the command line and inherited handles without ever setting creation flags. When none of our own stdio is a console there is no console to inherit, so the child is created CREATE_NO_WINDOW (0x08000000). An interactive console session always keeps at least stdin on a console and takes the unchanged path (a console-less child can still use inherited console handles for plain I/O, but console APIs fail in it, so interactive niu must keep the real console); non-Windows is a no-op. Unverifiable on this box (no Windows GUI parent here): needs a Windows reporter/CI confirmation that the flash is gone and interactive use is unchanged.
This was referenced Oct 28, 2026
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.
fix(shim): no more black console flash per invocation (niubash#379)
What
bash.exe(thesrc/bin/bash.rsshim) spawnsniu.exewith inheritedstdio and zero creation flags. When a GUI parent with no console of its
own (Claude Code) launches the shim with piped stdio, Windows allocates
a visible console for the child — one black flash per command.
Fix
Gate on all-three-stdio-redirected (pure
std, no new dependency):none of stdin/stdout/stderr is a console ⇒
CREATE_NO_WINDOW(
0x08000000) on the child. Interactive console sessions always keepat least stdin on a console and take the unchanged path — a console-less
child can still do plain I/O on inherited handles, but console APIs
(
ReadConsole/SetConsoleMode) fail in it, so interactiveniumustkeep inheriting the real console. Non-Windows is a no-op.
Verification
cargo build --bin bashclean,cargo test --bin bash4/4,cargo fmt --checkclean; shim still forwards (bash -c 'echo shim-alive'ok).CI runs the standard checks.
Windows confirmation (flash gone for piped
-c, interactive consoleunchanged) before release. The fix reaches the reporter via the next
niubash installer (rubash bump + release build).