[Bug][Windows] Sandboxed subprocess spawn flashes a visible console window from GUI hosts; STARTF_USESHOWWINDOW + SW_HIDE fixes it without the 0xC0000142 crash #1344
a1580311461-glitch
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The module comment explains why
CREATE_NO_WINDOW/CREATE_NEW_CONSOLEareintentionally absent: under this restricted-token scheme, hidden-console
children die with
STATUS_DLL_INIT_FAILED (0xC0000142)(verified empirically).But with no flag at all, a console-less GUI parent causes every child to get a
brand-new visible console window.
Suggested fix (verified working, no crash)
Keep
dwCreationFlags = 0(avoiding the 0xC0000142 path) and instead hide thenew console via STARTUPINFO: add
STARTF_USESHOWWINDOW (0x1)todwFlagsandset
wShowWindow = SW_HIDE (0):Tested on Windows: the sandboxed pwsh runs normally (stdio pipes unaffected,
sandbox enforcement intact) and no console window appears. This applies to both
spawnSandboxed(foreground) andspawnSandboxedInherited(background/runner)paths. Note: the same fix needs to land in every shipped copy of the package
(CLI node_modules + any desktop-host bundle), since desktop apps bundle their
own
@deepseek-ai/*dependency tree.All reactions