fix(cli): add CREATE_BREAKAWAY_FROM_JOB to windows_hide_flags() - #55667
fix(cli): add CREATE_BREAKAWAY_FROM_JOB to windows_hide_flags()#55667AlexFucuson9 wants to merge 1 commit into
Conversation
windows_hide_flags() returns only CREATE_NO_WINDOW (0x08000000). When Hermes runs inside an Electron wrapper (or any Job Object), CREATE_NO_WINDOW alone is silently ignored and cmd.exe windows flash on every subprocess spawn. Add CREATE_BREAKAWAY_FROM_JOB (0x01000000) so child processes escape the parent Job Object before the hide flag takes effect. Fixes NousResearch#55604
Duplicate of #55613 — both make the identical one-line change ( |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the proposed flag change. There is a compatibility issue with applying it through this shared helper.
Problems
hermes_cli/_subprocess_compat.py:138-144documents thatCREATE_BREAKAWAY_FROM_JOBcan makeCreateProcessraisePermissionError/OSErrorwhen a parent job disallows breakaway. The changedwindows_hide_flags()value reaches unguarded synchronous process creation intools/environments/base.py:145-153andtools/environments/local.py:1074-1088; neither retries without the bit.- The PR adds no regression coverage. Existing tests intentionally cover the separate detached-spawn fallback in
tests/tools/test_windows_native_support.py:582-625.
Suggested changes
- Validate the Electron path on native Windows, then keep breakaway targeted to a path that can retry without it when the job rejects breakaway.
- Add a Windows-specific behavioral test for that fallback, rather than only asserting a creation-flag bit.
Automated hermes-sweeper review.
| if not IS_WINDOWS: | ||
| return 0 | ||
| return _CREATE_NO_WINDOW | ||
| return _CREATE_NO_WINDOW | _CREATE_BREAKAWAY_FROM_JOB |
There was a problem hiding this comment.
This helper feeds synchronous terminal spawns (for example tools/environments/base.py:145-153). The module documents that a job which disallows breakaway makes this flag raise OSError, but these callers do not retry without it. Please keep this hidden-only helper unchanged or add a targeted path with the documented no-breakaway fallback.
|
Closing after the class-level fix in PR #70205 (merged as 0dbf639) — the premise here doesn't hold against Win32 semantics, and the underlying symptom is addressed at a different layer. Two problems with adding
If a flash persists at a specific spawn site on current main, that's worth a fresh issue with the process name from the flash — it would point at a leg the parent-console fix doesn't cover. Thanks for digging into the Windows spawn behavior. |
Summary
Adds
CREATE_BREAKAWAY_FROM_JOBtowindows_hide_flags()so subprocess console windows don't flash when Hermes runs inside an Electron/Tauri wrapper.Problem (P2 #55604)
windows_hide_flags()returns onlyCREATE_NO_WINDOW(0x08000000). Inside an Electron Job Object,CREATE_NO_WINDOWis silently ignored — cmd.exe flashes on every subprocess spawn.Fix
Add
CREATE_BREAKAWAY_FROM_JOB(0x01000000) so child processes escape the parent Job Object. This flag already exists in the module and is used bywindows_detach_flags().Changes
hermes_cli/_subprocess_compat.py: 1 line changedFixes #55604