Skip to content

Bun rejects powershell.exe argv containing -WindowStyle Hidden

args quoting · case

bothsilentscriptagentfirst-partyrepro: verifiedbun-windowstyle-argv-reject
Affectsbun, powershell 51, pwsh 7, windows
Fails assilent
Mechanismbun windowstyle argv reject
Safe fixcreate no window

PowerShell-based SID/process lookups and cleanup routines silently do nothing under Bun on Windows. No error surfaces in the happy path; the spawn itself failed before -Command ever ran.

// Bun 1.3.14, Windows
Bun.spawn(["powershell.exe", "-WindowStyle", "Hidden", "-Command", "whoami"]);
// spawn fails before PowerShell runs (#1589) — remove the -WindowStyle pair:
Bun.spawn(["powershell.exe", "-Command", "whoami"], { windowsHide: true }); // works

A Bun 1.3.14 Windows spawn bug: the adjacent "-WindowStyle", "Hidden" argv pair to powershell.exe makes process creation itself fail. Combined with the flag being useless for console suppression anyway (see windowstyle-hidden-vs-windowshide), keeping it in argv is all cost, no benefit.

  • Strip -WindowStyle Hidden from every direct PowerShell argv; rely on windowsHide: true (CREATE_NO_WINDOW).
  • Script-internal Start-Process -WindowStyle Hidden is a different construct and remains fine.
  • The fix added a sweep test forbidding the argv pair across the codebase.