launcher, server: one hidden-command helper per crate, server children keep its terminal

- horizon-bench reads the machine with horizon-telemetry's `command_output` (now public) instead
  of a second copy of it; the console flag lives in one place.
- horizon-server's `process::command` hides the console only when the server has none (started
  by the launcher). Run from a terminal, `schtasks`, `tar` and `mklink` share it as before, so
  their output still reaches it: a CREATE_NO_WINDOW child can't write to its parent's console.
- horizon-prepare's java/javac keep the stdin they had; only the console flag is new.
- launcher `process::hide_console` returns the command (no `let _ =` on other systems); the
  machine-details thread failing just leaves the report without them, as a slow one does.
- README: the Windows subsystem's effect on the command line (interactive cmd/PowerShell don't
  wait or set the exit code) under "Command line", the deferred probe under "Performance log".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-24 20:25:40 +02:00
parent 1be8a4caea
commit ac43cdea70
7 changed files with 41 additions and 56 deletions
+5 -6
View File
@@ -1,22 +1,21 @@
//! Background commands keep their configured streams without opening Windows consoles.
//! The programs the launcher runs in the background: on Windows they open no console window
//! (the launcher has none to share), and keep the streams their caller gives them.
use std::ffi::OsStr;
use std::process::Command;
/// Builds a background command. Callers still choose how to capture its input and output.
pub fn command(program: impl AsRef<OsStr>) -> Command {
let mut command = Command::new(program);
hide_console(&mut command);
command
}
/// Hides a background command's console on Windows, preserving its configured standard streams.
pub fn hide_console(command: &mut Command) {
/// [`command`] for a `Command` made elsewhere.
pub fn hide_console(command: &mut Command) -> &mut Command {
#[cfg(windows)]
{
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
command.creation_flags(CREATE_NO_WINDOW);
}
#[cfg(not(windows))]
let _ = command;
command
}