diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-03 11:37:11 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-03 11:37:24 -0500 |
commit | 10717b2b1f29a1b35742ae0cb98e775ac55e248c (patch) | |
tree | ceebb71087ce0c9ca3c1b23f55b94917bfccbed9 | |
parent | d152b349df84fbe1d37029315dfae04888495346 (diff) | |
download | nbsh-10717b2b1f29a1b35742ae0cb98e775ac55e248c.tar.gz nbsh-10717b2b1f29a1b35742ae0cb98e775ac55e248c.zip |
fix up a few bugs with child event handling
-rw-r--r-- | src/pipeline/mod.rs | 1 | ||||
-rw-r--r-- | 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); } |