Skip to content

fix(windows): bun server and chrome-headless-shell show black console windows on Windows #1835

@LHG4650

Description

@LHG4650

Summary

On Windows, when gstack browse starts the server, two black console windows appear on the taskbar and desktop:

  1. bun.exe — the browse server process
  2. chrome-headless-shell.exe — Playwright's Chromium headless shell

Root Cause

In browse/src/cli.ts (Windows path, ~line 326), the launcher code that spawns the bun server via child_process.spawn is missing the windowsHide: true option:

// Before (creates visible console window)
`{detached:true,stdio:['ignore','ignore','ignore'],env:...}`

// After (suppresses console window via CREATE_NO_WINDOW flag)
`{detached:true,windowsHide:true,stdio:['ignore','ignore','ignore'],env:...}`

On Windows, child_process.spawn({ detached: true }) allocates a new console window for the spawned process unless windowsHide: true is explicitly set (which maps to the Win32 CREATE_NO_WINDOW creation flag).

The chrome-headless-shell.exe window is a secondary effect — when the bun server process has a visible console, Playwright's Chromium child inherits or also gets a console window. Fixing the bun spawn should resolve both.

Fix

One-line change in browse/src/cli.ts:

-      `{detached:true,stdio:['ignore','ignore','ignore'],env:Object.assign({},process.env,`
+      `{detached:true,windowsHide:true,stdio:['ignore','ignore','ignore'],env:Object.assign({},process.env,`

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Shell: PowerShell + bash (Git for Windows)
  • Bun: ~/.nvm/bin/bun.exe
  • Playwright chromium: ms-playwright\chromium-headless_shell-1308

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions