cargo fmt
This commit is contained in:
parent
c6cff5ad66
commit
2f794802bc
1 changed files with 7 additions and 8 deletions
|
|
@ -3,23 +3,22 @@ use tokio::task::{spawn_blocking, JoinError};
|
|||
|
||||
pub enum SpawnError {
|
||||
CommandError(std::io::Error),
|
||||
SpawnBlockingError(JoinError)
|
||||
SpawnBlockingError(JoinError),
|
||||
}
|
||||
|
||||
pub async fn spawn_process(program: String, args: Vec<String>) -> Result<Output, SpawnError> {
|
||||
let output = spawn_blocking(move || {
|
||||
let output = Command::new(program)
|
||||
.args(args)
|
||||
.output();
|
||||
let output = Command::new(program).args(args).output();
|
||||
|
||||
match output {
|
||||
Ok(output) => Ok(output),
|
||||
Err(e) => Err(SpawnError::CommandError(e))
|
||||
Err(e) => Err(SpawnError::CommandError(e)),
|
||||
}
|
||||
}).await;
|
||||
})
|
||||
.await;
|
||||
|
||||
match output {
|
||||
Ok(output) => output,
|
||||
Err(e) => Err(SpawnError::SpawnBlockingError(e))
|
||||
Err(e) => Err(SpawnError::SpawnBlockingError(e)),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue