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 {
|
pub enum SpawnError {
|
||||||
CommandError(std::io::Error),
|
CommandError(std::io::Error),
|
||||||
SpawnBlockingError(JoinError)
|
SpawnBlockingError(JoinError),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn spawn_process(program: String, args: Vec<String>) -> Result<Output, SpawnError> {
|
pub async fn spawn_process(program: String, args: Vec<String>) -> Result<Output, SpawnError> {
|
||||||
let output = spawn_blocking(move || {
|
let output = spawn_blocking(move || {
|
||||||
let output = Command::new(program)
|
let output = Command::new(program).args(args).output();
|
||||||
.args(args)
|
|
||||||
.output();
|
|
||||||
|
|
||||||
match output {
|
match output {
|
||||||
Ok(output) => Ok(output),
|
Ok(output) => Ok(output),
|
||||||
Err(e) => Err(SpawnError::CommandError(e))
|
Err(e) => Err(SpawnError::CommandError(e)),
|
||||||
}
|
}
|
||||||
}).await;
|
})
|
||||||
|
.await;
|
||||||
|
|
||||||
match output {
|
match output {
|
||||||
Ok(output) => output,
|
Ok(output) => output,
|
||||||
Err(e) => Err(SpawnError::SpawnBlockingError(e))
|
Err(e) => Err(SpawnError::SpawnBlockingError(e)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue