pub trait CommandRunner {
// Required methods
fn run(
&self,
name: &str,
args: &[String],
opts: Option<Options>,
) -> ExecResult;
fn read_stdout(
&self,
name: &str,
args: &[String],
) -> Result<String, ExecError>;
fn run_sudo(&self, name: &str, args: &[String]) -> Result<(), ExecError>;
fn check(&self, name: &str, args: &[String]) -> Result<bool, ExecError>;
fn exec_streamed_command(
&self,
opts: Option<ExecStreamedOpts>,
name: &str,
args: &[String],
) -> Result<(), ExecError>;
fn look_path(&self, file: &str) -> Result<PathBuf, ExecError>;
fn run_in_repository(
&self,
repo_dir: &str,
name: &str,
args: &[String],
opts: Option<ExecStreamedOpts>,
) -> Result<(), ExecError>;
}Expand description
Ported from the CommandRunner interface in interface.go.
Deliberately kept fully synchronous (see PORT_NOTES.md’s Phase 4
architecture note): every implementation below bridges to
tokio::process::Command internally via runtime +
Runtime::block_on, so callers (and the cross-crate consumers in
xianyun-testutil/xianyun-backends/xianyun-cluster/
xianyun-deploy) see no trait signature change.
Required Methods§
fn run(&self, name: &str, args: &[String], opts: Option<Options>) -> ExecResult
fn read_stdout(&self, name: &str, args: &[String]) -> Result<String, ExecError>
fn run_sudo(&self, name: &str, args: &[String]) -> Result<(), ExecError>
fn check(&self, name: &str, args: &[String]) -> Result<bool, ExecError>
fn exec_streamed_command( &self, opts: Option<ExecStreamedOpts>, name: &str, args: &[String], ) -> Result<(), ExecError>
fn look_path(&self, file: &str) -> Result<PathBuf, ExecError>
fn run_in_repository( &self, repo_dir: &str, name: &str, args: &[String], opts: Option<ExecStreamedOpts>, ) -> Result<(), ExecError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".