pub trait ShellCommandExecutor: Send + Sync {
// Required methods
fn run(
&self,
command: Vec<String>,
cwd: PathBuf,
env_overlay: HashMap<String, String>,
cancel_rx: CancellationToken,
after_spawn: Option<Box<dyn FnOnce() + Send>>,
) -> ShellCommandExecutorFuture<'_, ExecResult>;
fn prepare_escalated_exec<'a>(
&'a self,
program: &'a AbsolutePathBuf,
argv: &'a [String],
workdir: &'a AbsolutePathBuf,
env: HashMap<String, String>,
execution: EscalationExecution,
) -> ShellCommandExecutorFuture<'a, PreparedExec>;
}Expand description
Adapter for running the shell command after the escalation server has been set up.
This lets shell-escalation own the Unix escalation protocol while the caller
keeps control over process spawning, output capture, and sandbox integration.
Implementations can capture any sandbox state they need.
Required Methods§
Sourcefn run(
&self,
command: Vec<String>,
cwd: PathBuf,
env_overlay: HashMap<String, String>,
cancel_rx: CancellationToken,
after_spawn: Option<Box<dyn FnOnce() + Send>>,
) -> ShellCommandExecutorFuture<'_, ExecResult>
fn run( &self, command: Vec<String>, cwd: PathBuf, env_overlay: HashMap<String, String>, cancel_rx: CancellationToken, after_spawn: Option<Box<dyn FnOnce() + Send>>, ) -> ShellCommandExecutorFuture<'_, ExecResult>
Runs the requested shell command and returns the captured result.
env_overlay contains only the wrapper/socket variables exported by
EscalationSession::env(), not a complete child environment.
Implementations should merge it into whatever base environment they use
for the shell process. after_spawn should be invoked immediately after
the shell process has been spawned so the parent copy of the inherited
escalation socket can be closed.
Sourcefn prepare_escalated_exec<'a>(
&'a self,
program: &'a AbsolutePathBuf,
argv: &'a [String],
workdir: &'a AbsolutePathBuf,
env: HashMap<String, String>,
execution: EscalationExecution,
) -> ShellCommandExecutorFuture<'a, PreparedExec>
fn prepare_escalated_exec<'a>( &'a self, program: &'a AbsolutePathBuf, argv: &'a [String], workdir: &'a AbsolutePathBuf, env: HashMap<String, String>, execution: EscalationExecution, ) -> ShellCommandExecutorFuture<'a, PreparedExec>
Prepares an escalated subcommand for execution on the server side.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".