1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
use std::{sync::RwLock, time::Duration};
use slog::Logger;
use synchronoise::SignalEvent;
use crate::{
config::Config,
error::TracerError,
terminal::{write_term, Terminal},
};
use super::ImageAction;
pub struct WaitForSignal {}
impl ImageAction for WaitForSignal {
fn action(
&self,
_screen_buffer: &RwLock<Vec<u32>>,
cancel_event: &SignalEvent,
event: &SignalEvent,
_config: &Config,
_log: Logger,
term: &Terminal,
) -> Result<(), TracerError> {
if !event.status() {
write_term!(term, "Press R to resume.");
while !event.wait_timeout(Duration::from_secs(1)) && !cancel_event.status() {}
}
event.reset();
Ok(())
}
}
|