Ctrl+C handling documentation
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -31,13 +31,13 @@ where
|
||||
return Ok(Some((key, success)));
|
||||
}
|
||||
|
||||
let running = ctrlc::running();
|
||||
if !running {
|
||||
ctrlc::set_running(true);
|
||||
let interrupted = ctrlc::interrupted();
|
||||
if interrupted {
|
||||
ctrlc::unset_interrupted();
|
||||
}
|
||||
|
||||
let should_ask = !running || !no_retry;
|
||||
let should_retry = should_ask && should_retry(running).context(ErrorKind::Retry)?;
|
||||
let should_ask = interrupted || !no_retry;
|
||||
let should_retry = should_ask && should_retry(interrupted).context(ErrorKind::Retry)?;
|
||||
|
||||
if !should_retry {
|
||||
return Ok(Some((key, success)));
|
||||
|
||||
Reference in New Issue
Block a user