From 6e0c0679d02c20258bfabf370f5a977644eea6e7 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 4 Mar 2022 18:58:34 -0500 Subject: remove unused file --- src/shell/history/job.rs | 63 ------------------------------------------------ 1 file changed, 63 deletions(-) delete mode 100644 src/shell/history/job.rs (limited to 'src') diff --git a/src/shell/history/job.rs b/src/shell/history/job.rs deleted file mode 100644 index 5c73f4d..0000000 --- a/src/shell/history/job.rs +++ /dev/null @@ -1,63 +0,0 @@ -use crate::shell::prelude::*; - -pub struct Job {} - -impl Job { - pub fn new( - cmdline: &str, - env: Env, - pts: &pty_process::Pts, - event_w: crate::shell::event::Writer, - ) -> Result { - let (child, fh) = spawn_command(cmdline, &env, pts)?; - let state = std::sync::Arc::new(std::sync::Mutex::new( - State::Running((0, 0)), - )); - tokio::spawn(Self::task( - child, - fh, - std::sync::Arc::clone(&state), - env, - event_w, - )); - Ok(Self { - state, - start_time, - start_instant, - }) - } - - pub fn start_time(&self) -> &time::OffsetDateTime { - &self.start_time - } - - pub fn start_instant(&self) -> &std::time::Instant { - &self.start_instant - } - - pub fn with_state(&self, f: impl FnOnce(&State) -> T) -> T { - let state = self.state.lock().unwrap(); - f(&state) - } - - pub fn with_state_mut(&self, f: impl FnOnce(&mut State) -> T) -> T { - let mut state = self.state.lock().unwrap(); - f(&mut state) - } - - pub fn lock_state(&self) -> std::sync::MutexGuard { - self.state.lock().unwrap() - } - - pub fn running(&self) -> bool { - self.with_state(|state| matches!(state, State::Running(..))) - } - - pub fn set_span(&self, new_span: (usize, usize)) { - self.with_state_mut(|state| { - if let State::Running(span) = state { - *span = new_span; - } - }); - } -} -- cgit v1.2.3-54-g00ecf