pub trait CommandRunner:
Send
+ Sync
+ Debug {
// Required method
fn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
program: &'life1 str,
args: &'life2 [String],
env: &'life3 [(String, String)],
cancel: &'life4 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
}Expand description
Trait abstracting an external command execution. The default
implementation is TokioCommandRunner.
Implementations must honour cancel: if the token fires while the child
is running, the child should be killed and the call should return
MigrationError::Cancelled. Without this, a multi-hour pg_dump
would ignore Ctrl+C until completion.
Required Methods§
Sourcefn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
program: &'life1 str,
args: &'life2 [String],
env: &'life3 [(String, String)],
cancel: &'life4 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn run<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
program: &'life1 str,
args: &'life2 [String],
env: &'life3 [(String, String)],
cancel: &'life4 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Run program with args and the given environment additions. Should
fail if the process exits with a non-zero status, or return
MigrationError::Cancelled if cancel fires before the child
exits.