Skip to main content

Module windows_process

Module windows_process 

Source
Expand description

Windows process-creation helpers for non-PTY children.

PTY / ConPTY spawns must keep a console; everything else (ACP, app-server, m4a-agent, spawn profiles, probes, schtasks, powershell helpers) must not pop a visible window. Closing a console must not kill a supervised node.

Constants§

CREATE_NEW_PROCESS_GROUP
CREATE_NEW_PROCESS_GROUP (0x00000200).
CREATE_NO_WINDOW
CREATE_NO_WINDOW (0x08000000). Safe to OR with other creation flags.
DETACHED_PROCESS
DETACHED_PROCESS (0x00000008) — no console inheritance.
HEADLESS_SPAWN_FLAGS
Flags for a headless node / child: no window, detached from the parent’s console.

Functions§

current_user_identity
Current user SID (S-1-5-…) and DOMAIN\User for Task Scheduler XML. Empty strings on non-Windows.
free_console
Detach this process from its console (if any). No-op on non-Windows.
hide_console
Apply CREATE_NO_WINDOW on Windows. No-op elsewhere. Does not touch program, args, env, cwd, or stdio. Call once: a second creation_flags replaces the previous value — use set_creation_flags to OR.
hide_console_detached
Spawn flags for the supervised child node (no console, detached).
hide_console_tokio
Same for tokio’s command (via as_std_mut).
ignore_console_close_events
Ignore CTRL_CLOSE / CTRL_LOGOFF / CTRL_SHUTDOWN so closing a terminal that somehow still owns us does not kill a supervised node. CTRL_C still works for interactive CLI. No-op on non-Windows.
relaunch_elevated
Re-launch this process elevated via UAC (runas). Returns after the elevated process exits, or an error if the user declines / API fails.
set_creation_flags
OR flags into the command’s Windows creation flags.