Merge pull request #3808 from fufesou/fix/linux_zombie_process

Fix/linux zombie process
This commit is contained in:
RustDesk 2023-03-28 09:29:31 +08:00 committed by GitHub
commit 954bedcd96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ use crate::{
hw, ImageFormat, HW_STRIDE_ALIGN,
};
use hbb_common::{
allow_err,
anyhow::{anyhow, Context},
bytes::Bytes,
config::HwCodecConfig,
@ -352,7 +353,21 @@ pub fn check_config_process(force_reset: bool) {
let second = 3;
std::thread::sleep(std::time::Duration::from_secs(second));
// kill: Different platforms have different results
child.kill().ok();
allow_err!(child.kill());
std::thread::sleep(std::time::Duration::from_millis(30));
match child.try_wait() {
Ok(Some(status)) => log::info!("Check hwcodec config, exit with: {status}"),
Ok(None) => {
log::info!(
"Check hwcodec config, status not ready yet, let's really wait"
);
let res = child.wait();
log::info!("Check hwcodec config, wait result: {res:?}");
}
Err(e) => {
log::error!("Check hwcodec config, error attempting to wait: {e}")
}
}
HwCodecConfig::refresh();
}
}