fix: add creationflags to plugins subprocess calls (Windows console flash) - #65660
fix: add creationflags to plugins subprocess calls (Windows console flash)#65660AlexFucuson9 wants to merge 1 commit into
Conversation
…lash) On Windows, subprocess.run()/Popen() without CREATE_NO_WINDOW (0x08000000) spawns a visible console window that flashes briefly. Three plugins have non-interactive subprocess calls missing this flag: - plugins/platforms/telegram/adapter.py: ffprobe duration check - plugins/platforms/discord/voice_mixer.py: ffmpeg PCM decode - plugins/platforms/raft/adapter.py: raft bridge Popen All three have stdin=DEVNULL and capture_output=True (or are Popen with no interactive I/O), so they should not show a console window.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for identifying three current Windows subprocess gaps. The premise holds on current main: the ffmpeg, ffprobe, and Raft bridge calls at plugins/platforms/discord/voice_mixer.py:312-324, plugins/platforms/telegram/adapter.py:353-357, and plugins/platforms/raft/adapter.py:548-550 have no creationflags.
Problems
- The new raw
0x08000000/sys.platformbranches bypass the project helper.hermes_cli/_subprocess_compat.py:186-201provideswindows_hide_flags()specifically for this behavior and returns0on POSIX. - The sweep leaves current Windows sibling calls uncovered: WhatsApp's
taskkillatplugins/platforms/whatsapp/adapter.py:223-228and Node version probe at:349-354also have no no-window flag. - The diff adds no regression coverage.
tests/test_windows_subprocess_no_window_flags.py:304-320shows the existing mocked assertion pattern.
Suggested changes
- Use
windows_hide_flags()for all three changed calls. - Add focused flag-propagation tests, and include or split the verified WhatsApp siblings.
Automated hermes-sweeper review.
| capture_output=True, | ||
| timeout=timeout, | ||
| stdin=subprocess.DEVNULL, | ||
| **({"creationflags": 0x08000000} if sys.platform == "win32" else {}), |
There was a problem hiding this comment.
Please use windows_hide_flags() here (and at the other two new sites) rather than a raw literal/platform branch. hermes_cli._subprocess_compat centralizes this policy and returns 0 on POSIX.
|
Closing after the class-level fix in PR #70205 (commit 0dbf639): Windows console flashes were caused by Hermes daemons running console-less (pythonw / DETACHED_PROCESS parents), forcing every console-subsystem child to allocate its own visible window. Main now launches every daemon (gateway, Scheduled Task, UAC handoff, dashboard, desktop backend) with a hidden console that all descendants inherit — so the spawn sites this PR flags no longer have a reachable flash under any shipped launch path (interactive terminals never flashed; children inherit the visible console there). The sites you patched were genuinely unflagged, and the diagnosis was sound against the old launch topology — the ground just moved under it. Rather than keep growing per-site flags across an unbounded set of leaf spawns, we're standardizing on the parent-console fix. If a flash reappears on current main under a shipped launch path, that's a new bug — please file it with the flashing process name. Thanks for the contribution and the Windows attention; sorry this one got mooted at the root. |
Summary
On Windows,
subprocess.run()/subprocess.Popen()withoutCREATE_NO_WINDOW(0x08000000) spawns a visible console window (cmd.exe / conhost.exe) that flashes briefly. Three plugins have non-interactive subprocess calls missing this flag:plugins/platforms/telegram/adapter.py— ffprobe duration check (line 353)plugins/platforms/discord/voice_mixer.py— ffmpeg PCM decode (line 312)plugins/platforms/raft/adapter.py— raft bridge Popen (line 548)All three have
stdin=DEVNULLandcapture_output=True(or are Popen with no interactive I/O), so they should not show a console window.Fix
Add
creationflags=0x08000000on Windows, same pattern used in:tools/tts_tool.py(6 calls)tools/browser_tool.py(2 calls)tools/tirith_security.py(2 calls)tools/env_probe.pytools/lazy_deps.pyChanges
plugins/platforms/telegram/adapter.py: +2 linesplugins/platforms/discord/voice_mixer.py: +2 linesplugins/platforms/raft/adapter.py: +2 linesTest Plan