Skip to content

Conversation

@robobun
Copy link
Collaborator

@robobun robobun commented Jan 29, 2026

Summary

  • Fixes Windows conhost console fonts changing to raster fonts when using shell $ to spawn PowerShell

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

Note: Bun.spawn() doesn't have this issue because it defaults windowsHide to false.

The fix

Changed hide_window from true to false for shell spawns in src/shell/subproc.zig, matching the default behavior of Bun.spawn().

Test plan

  • Build passes
  • Manual verification on Windows with cmd in conhost running PowerShell via $\powershell``

Fixes #26558

🤖 Generated with Claude Code

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>
@robobun
Copy link
Collaborator Author

robobun commented Jan 29, 2026

Updated 8:11 AM PT - Jan 29th, 2026

❌ Your commit e0a73a40 has 5 failures in Build #36106 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 26559

That installs a local version of the PR into your bun-26559 executable, so you can run:

bun-26559 --bun

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

Walkthrough

This change modifies the Windows-specific subprocess spawn configuration in the shell handling code, setting the hide_window parameter to false. This alters how spawned process windows are displayed in the Windows environment.

Changes

Cohort / File(s) Summary
Windows subprocess configuration
src/shell/subproc.zig
Modified Windows spawn options to set hide_window to false, changing the visibility behavior of spawned process windows.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately describes the main change: fixing the UV_PROCESS_WINDOWS_HIDE flag behavior for shell spawns.
Description check ✅ Passed The description is comprehensive and covers the problem, root cause, solution, and test plan, though it follows a custom format rather than the template structure.
Linked Issues check ✅ Passed The change directly addresses the linked issue #26558 by modifying hide_window from true to false in src/shell/subproc.zig to prevent conhost font resets when spawning PowerShell.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to fixing the reported issue; only one configuration parameter changed in one file with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • FONT-26558: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.

Comment on lines 812 to 816
.windows = if (Environment.isWindows) bun.spawn.WindowsSpawnOptions.WindowsOptions{
.hide_window = true,
.hide_window = false,
.loop = event_loop,
},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Search for windowsHide default in Bun.spawn implementation
rg -n 'windowsHide' --type=ts --type=tsx -B2 -A2 src/ | head -100

Repository: 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 -150

Repository: 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 -200

Repository: 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 -100

Repository: 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.zig

Repository: 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.

@robobun
Copy link
Collaborator Author

robobun commented Jan 29, 2026

Ran bun run zig:check-all as suggested - all 61 steps succeeded across all platforms (Windows x86_64/aarch64, macOS x86_64/aarch64, Linux x86_64/aarch64 with both glibc and musl).

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Executing powershell commands from cmd in conhost using $ will result in fonts being set to raster fonts

2 participants