let stderr = ipif.stderr.take().unwrap();
let ic_name = ic.to_string();
- let _ = task::spawn(async move {
+ let stderr_task = task::spawn(async move {
let mut stderr = tokio::io::BufReader::new(stderr).lines();
while let Some(l) = stderr.next_line().await? {
error!("{}: ipif stderr: {}", &ic_name, l.trim_end());
match ipif.wait().await {
Err(e) => error!("{}: also, failed to await ipif child: {}", &ic, e),
- Ok(st) if st.success() => { },
- Ok(st) => error!("{}: ipif process failed: {}", &ic, st),
+ Ok(st) => {
+ let stderr_timeout = Duration::from_millis(100);
+ match tokio::time::timeout(stderr_timeout, stderr_task).await {
+ Err::<_,tokio::time::error::Elapsed>(_)
+ => warn!("{}: ipif stderr task continues!", &ic),
+ Ok(Err(e)) => error!("{}: ipif stderr task crashed: {}", &ic, e),
+ Ok(Ok(Err(e))) => error!("{}: ipif stderr read failed: {}", &ic, e),
+ Ok(Ok(Ok(()))) => { },
+ }
+ if ! st.success() {
+ error!("{}: ipif process failed: {}", &ic, st);
+ }
+ }
}
trouble