mirror of
https://github.com/nushell/nushell
synced 2025-01-05 01:39:02 +00:00
14 lines
300 B
Rust
14 lines
300 B
Rust
|
use std::sync::{
|
||
|
atomic::{AtomicBool, Ordering},
|
||
|
Arc,
|
||
|
};
|
||
|
|
||
|
/// Returns true if Nu has received a SIGINT signal / ctrl+c event
|
||
|
pub fn was_pressed(ctrlc: &Option<Arc<AtomicBool>>) -> bool {
|
||
|
if let Some(ctrlc) = ctrlc {
|
||
|
ctrlc.load(Ordering::SeqCst)
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|