Ctrl+C handling documentation

This commit is contained in:
Roey Darwish Dror
2018-12-31 14:07:55 +02:00
parent 19de361775
commit a404df9c97
5 changed files with 29 additions and 17 deletions

View File

@@ -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)));