1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-26 03:27:30 +00:00

refactor(process_control): switch to new API (#3385)

This commit is contained in:
David Knaack 2022-01-03 15:14:19 +01:00 committed by GitHub
parent 86be86d729
commit 35eae3fb4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
use process_control::{ChildExt, Timeout}; use process_control::{ChildExt, Control};
use std::ffi::OsStr; use std::ffi::OsStr;
use std::fmt::Debug; use std::fmt::Debug;
use std::fs::read_to_string; use std::fs::read_to_string;
@ -393,7 +393,12 @@ pub fn exec_timeout(cmd: &mut Command, time_limit: Duration) -> Option<CommandOu
return None; return None;
} }
}; };
match process.with_output_timeout(time_limit).terminating().wait() { match process
.controlled_with_output()
.time_limit(time_limit)
.terminate_for_timeout()
.wait()
{
Ok(Some(output)) => { Ok(Some(output)) => {
let stdout_string = match String::from_utf8(output.stdout) { let stdout_string = match String::from_utf8(output.stdout) {
Ok(stdout) => stdout, Ok(stdout) => stdout,