Skip to main content

suppress_console

Function suppress_console 

Source
pub fn suppress_console(cmd: &mut Command) -> &mut Command
Expand description

Stop Windows from allocating a console window for a console-subsystem child.

Redirecting stdio is not enough: powercfg.exe and cmd.exe are console subsystem binaries, so Windows gives each spawn its own console, which flashes on screen and steals focus for a few frames. Entracte’s detection probes run on a 10 s loop, so that surfaced as a cmd window blinking every ten seconds for the whole session (#303).

CREATE_NO_WINDOW suppresses the console while leaving the child attached to the pipes we hand it — unlike DETACHED_PROCESS, which would also suppress the window but break output capture. Non-Windows targets have no console to suppress, so this is a no-op there and callers stay platform-agnostic.