Bun rejects powershell.exe argv containing -WindowStyle Hidden
args quoting · case
Affectsbun, powershell 51, pwsh 7, windows
Fails assilent
Mechanismbun windowstyle argv reject
Safe fixcreate no window
Symptom
Section titled “Symptom”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, WindowsBun.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 }); // worksA 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.
Workaround
Section titled “Workaround”- Strip
-WindowStyle Hiddenfrom every direct PowerShell argv; rely onwindowsHide: true(CREATE_NO_WINDOW). - Script-internal
Start-Process -WindowStyle Hiddenis a different construct and remains fine. - The fix added a sweep test forbidding the argv pair across the codebase.