Skip to main content

Module platform

Module platform 

Source
Expand description

Operating-system conditional abstractions.

Platform initialization (initialize_platform) is the first I/O-related step after signal/telemetry bootstrap in crate::run. It configures:

  • Windows: console UTF-8 (code page 65001) + virtual terminal processing for ANSI colors under cmd.exe / PowerShell 5.1 / Windows Terminal
  • Linux / Unix: sandbox detection (Flatpak/Snap) with observability warn
  • macOS: no-op init (paths via directories; Gatekeeper is user-side)

§Runtime environment

detect_runtime classifies WSL, containers, CI, Termux, and distribution sandboxes without spawning external processes. Results feed vps doctor --json diagnostics (agent-visible, no secrets).

§Product scope (N/A by design)

  • Browser / Chrome / chromedriver discovery — not an SSH concern
  • WASM / WASI targets — russh requires real sockets; not shipped
  • Job Objects / local Command children — no privileged local subprocess tree
  • OpenBSD pledge/unveil, seccomp, setrlimit — optional hardening; not default

§External processes (G-PROC audit)

Runtime never shells out (uname, ssh, scp, systemctl, etc.). SSH transport is pure russh. The only std::process::Command uses in the tree are:

SiteBinaryWhenFailure mode
build.rsgit (optional)embed commit hashunknown / env / .commit_hash
integration testsssh-keygen (optional fixture)OpenSSH key filesskip / assert
integration testsssh-cli under testassert_cmd e2etest failure

Toolchain MSRV 1.85.0 exceeds Rust 1.77.2 (CVE-2024-24576 / BatBadBut); product still never invokes .bat/.cmd children.

Structs§

RuntimeEnvironment
Detected host runtime (process environment classification).

Functions§

detect_runtime
Classifies the current process runtime (cheap, side-effect free).
initialize_platform
Initializes the platform before user-facing I/O.
is_tty
Returns true if stdout is connected to a terminal (TTY).
normalize_stdin_line
Normalizes a stdin line by stripping trailing \r (CRLF → LF).