-
Notifications
You must be signed in to change notification settings - Fork 4k
fix(shell): don't set UV_PROCESS_WINDOWS_HIDE for shell spawns #26559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
When using the shell `$` function to spawn processes on Windows in conhost, the console fonts were being changed to raster fonts after execution. This was caused by always setting `hide_window = true` for shell spawns, which translates to the UV_PROCESS_WINDOWS_HIDE flag. This flag affects how Windows creates child process windows, and when interactive programs like PowerShell exit, the conhost console resets its display properties including fonts to defaults (raster fonts). The fix changes `hide_window` from `true` to `false` for shell spawns, matching the default behavior of `Bun.spawn()` which doesn't have this issue. Fixes #26558 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Updated 8:11 AM PT - Jan 29th, 2026
❌ Your commit
🧪 To try this PR locally: bunx bun-pr 26559That installs a local version of the PR into your bun-26559 --bun |
WalkthroughThis change modifies the Windows-specific subprocess spawn configuration in the shell handling code, setting the Changes
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/shell/subproc.zig`:
- Around line 812-816: The shell spawn on Windows currently needs to explicitly
disable the window-hiding flag: in src/shell/subproc.zig, when
Environment.isWindows construct the bun.spawn.WindowsSpawnOptions.WindowsOptions
for shell spawns and set .hide_window = false (so UV_PROCESS_WINDOWS_HIDE is not
applied), keeping .loop = event_loop as before; after making this
platform-specific change, run the suggested compile check with `bun run
zig:check-all` to verify the Zig changes across platforms.
| .windows = if (Environment.isWindows) bun.spawn.WindowsSpawnOptions.WindowsOptions{ | ||
| .hide_window = true, | ||
| .hide_window = false, | ||
| .loop = event_loop, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Search for windowsHide default in Bun.spawn implementation
rg -n 'windowsHide' --type=ts --type=tsx -B2 -A2 src/ | head -100Repository: oven-sh/bun
Length of output: 82
🏁 Script executed:
# Search for hide_window usage in Zig files to understand the mapping
rg -n 'hide_window' --type=zig -B3 -A3 src/ | head -150Repository: oven-sh/bun
Length of output: 1860
🏁 Script executed:
# Check the specific file context around line 812-816
cat -n src/shell/subproc.zig | sed -n '800,830p'Repository: oven-sh/bun
Length of output: 1405
🏁 Script executed:
# Search for WindowsSpawnOptions struct definition
rg -n 'WindowsSpawnOptions|WindowsOptions' --type=zig -B2 -A10 src/ | head -200Repository: oven-sh/bun
Length of output: 11382
🏁 Script executed:
# Search for windowsHide in JavaScript bindings/spawn API
rg -n 'windowsHide' --type=ts -B3 -A3 | head -100Repository: oven-sh/bun
Length of output: 5709
🏁 Script executed:
# Check js_bun_spawn_bindings for how windowsHide is handled
cat -n src/bun.js/api/bun/js_bun_spawn_bindings.zig | sed -n '570,600p'Repository: oven-sh/bun
Length of output: 1748
🏁 Script executed:
# Search for any comments or context around the change in shell/subproc.zig
git log --oneline -20 -- src/shell/subproc.zigRepository: oven-sh/bun
Length of output: 126
Fix correctly prevents window hiding flag from being set for shell spawns on Windows.
Setting hide_window = false prevents the UV_PROCESS_WINDOWS_HIDE flag from being set, which was causing conhost to reset font properties when interactive child processes exit. This aligns shell behavior with Node.js child_process defaults (where windowsHide defaults to false when undefined).
As per coding guidelines: "When making platform-specific changes, run bun run zig:check-all to compile the Zig code on all platforms."
The review comment's claim about parity with Bun.spawn() defaults is inaccurate—the Zig struct WindowsOptions actually defaults hide_window to true. The fix correctly overrides this for shell spawns to maintain Node.js compatibility.
🤖 Prompt for AI Agents
In `@src/shell/subproc.zig` around lines 812 - 816, The shell spawn on Windows
currently needs to explicitly disable the window-hiding flag: in
src/shell/subproc.zig, when Environment.isWindows construct the
bun.spawn.WindowsSpawnOptions.WindowsOptions for shell spawns and set
.hide_window = false (so UV_PROCESS_WINDOWS_HIDE is not applied), keeping .loop
= event_loop as before; after making this platform-specific change, run the
suggested compile check with `bun run zig:check-all` to verify the Zig changes
across platforms.
|
Ran |
Summary
$to spawn PowerShellWhat was the problem?
When using the shell
$function to spawn processes on Windows in conhost, the console fonts were being changed to raster fonts after execution. This was caused by always settinghide_window = truefor shell spawns, which translates to theUV_PROCESS_WINDOWS_HIDEflag.This flag affects how Windows creates child process windows, and when interactive programs like PowerShell exit, the conhost console resets its display properties including fonts to defaults (raster fonts).
Note:
Bun.spawn()doesn't have this issue because it defaultswindowsHidetofalse.The fix
Changed
hide_windowfromtruetofalsefor shell spawns insrc/shell/subproc.zig, matching the default behavior ofBun.spawn().Test plan
$\powershell``Fixes #26558
🤖 Generated with Claude Code