From 10717b2b1f29a1b35742ae0cb98e775ac55e248c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 3 Jan 2022 11:37:11 -0500 Subject: fix up a few bugs with child event handling --- src/pipeline/mod.rs | 1 + src/state/history/mod.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs index f1caf12..6be63f6 100644 --- a/src/pipeline/mod.rs +++ b/src/pipeline/mod.rs @@ -36,6 +36,7 @@ async fn write_event(event: crate::event::Event) { fd4.write_all(&bincode::serialize(&event).unwrap()) .await .unwrap(); + fd4.flush().await.unwrap(); let _ = fd4.into_raw_fd(); } diff --git a/src/state/history/mod.rs b/src/state/history/mod.rs index fa02b98..5ed86b3 100644 --- a/src/state/history/mod.rs +++ b/src/state/history/mod.rs @@ -593,9 +593,9 @@ async fn run_pipeline( Res::Read( blocking::unblock(move || { let fh = unsafe { std::fs::File::from_raw_fd(from_r) }; - let env = bincode::deserialize_from(&fh); + let event = bincode::deserialize_from(&fh); let _ = fh.into_raw_fd(); - env + event }) .await, ) @@ -604,6 +604,11 @@ async fn run_pipeline( match read.or(exit).await { Res::Read(Ok(event)) => event_w.send(event).await.unwrap(), Res::Read(Err(e)) => { + if let bincode::ErrorKind::Io(e) = &*e { + if e.kind() == std::io::ErrorKind::UnexpectedEof { + continue; + } + } eprintln!("nbsh: {}", e); return (std::process::ExitStatus::from_raw(1 << 8), false); } -- cgit v1.2.3-54-g00ecf