pub struct Driver { /* private fields */ }Expand description
A command driver.
A command driver is an abstraction through which shell commands can be dispatched within various locales (e.g., your local computer, remotely over SSH, etc).
In addition to containing the state around those connections, the driver also holds configuration necessary to know how to execute the commands (e.g., which shell to use when running).
Implementations§
Source§impl Driver
impl Driver
Sourcepub async fn initialize(config: Config) -> Result<Self>
pub async fn initialize(config: Config) -> Result<Self>
Initializes a new Driver.
This command requires an async runtime because, for some transports, negotiation is done via subprocesses or network calls to initialize the necessary state (e.g., establishing an SSH session with a remote host).
NOTE: this method returns an anyhow::Result because any errors
are intended to be returned directly to the user in the calling binary
(i.e., the errors are typically unrecoverable).
Sourcepub async fn run(&self, command: impl Into<String>) -> Result<Output>
pub async fn run(&self, command: impl Into<String>) -> Result<Output>
Runs a shell command within the configuration locale.
NOTE: this method returns an anyhow::Result because any errors
are intended to be returned directly to the user in the calling binary
(i.e., the errors are typically unrecoverable).