diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-05 07:30:34 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-05 07:30:34 -0500 |
commit | f9c5cb86304748baf0da99126bf75c5a3cd3e773 (patch) | |
tree | 7583e15d3e6b82db02b3815516309fc4bb4ebfb3 /src/shell/history | |
parent | a30174620d6b64f838989a634c265a353b2ab117 (diff) | |
download | nbsh-f9c5cb86304748baf0da99126bf75c5a3cd3e773.tar.gz nbsh-f9c5cb86304748baf0da99126bf75c5a3cd3e773.zip |
and more simplification
Diffstat (limited to 'src/shell/history')
-rw-r--r-- | src/shell/history/entry.rs | 10 | ||||
-rw-r--r-- | src/shell/history/mod.rs | 13 | ||||
-rw-r--r-- | src/shell/history/pty.rs | 3 |
3 files changed, 8 insertions, 18 deletions
diff --git a/src/shell/history/entry.rs b/src/shell/history/entry.rs index ab08a72..d804c92 100644 --- a/src/shell/history/entry.rs +++ b/src/shell/history/entry.rs @@ -1,10 +1,8 @@ use crate::shell::prelude::*; -use std::os::unix::process::ExitStatusExt as _; - pub struct Entry { cmdline: String, - env: crate::Env, + env: Env, vt: vt100::Parser, audible_bell_state: usize, visual_bell_state: usize, @@ -19,7 +17,7 @@ pub struct Entry { impl Entry { pub fn new( cmdline: String, - env: crate::Env, + env: Env, size: (u16, u16), input: async_std::channel::Sender<Vec<u8>>, resize: async_std::channel::Sender<(u16, u16)>, @@ -216,7 +214,7 @@ impl Entry { &self.cmdline } - pub fn env(&self) -> &crate::Env { + pub fn env(&self) -> &Env { &self.env } @@ -273,7 +271,7 @@ impl Entry { pub async fn finish( &mut self, - env: crate::Env, + env: Env, event_w: async_std::channel::Sender<Event>, ) { self.exit_info = Some(ExitInfo::new(*env.latest_status())); diff --git a/src/shell/history/mod.rs b/src/shell/history/mod.rs index 76e7d3b..d8adb49 100644 --- a/src/shell/history/mod.rs +++ b/src/shell/history/mod.rs @@ -1,10 +1,5 @@ use crate::shell::prelude::*; -use async_std::io::WriteExt as _; -use futures_lite::future::FutureExt as _; -use std::os::unix::io::{FromRawFd as _, IntoRawFd as _}; -use std::os::unix::process::ExitStatusExt as _; - mod entry; pub use entry::Entry; mod pty; @@ -93,7 +88,7 @@ impl History { pub async fn run( &mut self, ast: crate::parse::Commands, - env: &crate::Env, + env: &Env, event_w: async_std::channel::Sender<Event>, ) -> anyhow::Result<usize> { let (input_w, input_r) = async_std::channel::unbounded(); @@ -124,7 +119,7 @@ impl History { pub async fn parse_error( &mut self, e: crate::parse::Error, - env: &crate::Env, + env: &Env, event_w: async_std::channel::Sender<Event>, ) -> anyhow::Result<usize> { // XXX would be great to not have to do this @@ -274,7 +269,7 @@ impl std::iter::DoubleEndedIterator for VisibleEntries { fn run_commands( ast: crate::parse::Commands, entry: async_std::sync::Arc<async_std::sync::Mutex<Entry>>, - mut env: crate::Env, + mut env: Env, input_r: async_std::channel::Receiver<Vec<u8>>, resize_r: async_std::channel::Receiver<(u16, u16)>, event_w: async_std::channel::Sender<Event>, @@ -330,7 +325,7 @@ fn run_commands( async fn run_pipeline( pty: &pty::Pty, - env: &mut crate::Env, + env: &mut Env, event_w: async_std::channel::Sender<Event>, ) -> anyhow::Result<(async_std::process::ExitStatus, bool)> { let mut cmd = pty_process::Command::new(std::env::current_exe().unwrap()); diff --git a/src/shell/history/pty.rs b/src/shell/history/pty.rs index 602a568..edf06c2 100644 --- a/src/shell/history/pty.rs +++ b/src/shell/history/pty.rs @@ -1,8 +1,5 @@ use crate::shell::prelude::*; -use async_std::io::{ReadExt as _, WriteExt as _}; -use futures_lite::future::FutureExt as _; - pub struct Pty { pty: async_std::sync::Arc<pty_process::Pty>, close_w: async_std::channel::Sender<()>, |