Expand description
Resolve how the harness gains root to load the scheduler, and build the
privileged commands. Ported from the Python harness’s setup_sudo.
Precedence:
- already root -> run directly, no sudo
$SUDO_ASKPASSset ->sudo -A(use the caller’s askpass)- password file (from the spec via
resolve(), or from$SCX_SUDO_PASSWORD_FILE) -> generate an askpass shim that prints the file’s contents and usesudo -A; the password stays in the file and never appears in argv or the process table. The shim path is exported to spawned sudo commands only (viaCommand::env), never to the agent’s own environment. - otherwise ->
sudo -n(passwordless / cached credentials)
Re-exports§
use std::os::unix::fs::PermissionsExt;🔒use std::path::Path;🔒use std::path::PathBuf;🔒use std::process::Command;🔒use anyhow::Context;🔒use anyhow::Result;🔒
Structs§
- Sudo
- Resolved sudo strategy: the argv prefix plus any owned askpass shim.
- Temp
Shim 🔒 - A generated askpass shim, removed from disk when dropped (replaces atexit).
Functions§
- shell_
quote 🔒 - Single-quote a path for safe embedding in a /bin/sh script.