ErrorKind::Interrupted
RustINFOCriticalI/O
System call interrupted
Quick Answer
Retry the operation in a loop; Interrupted is transient.
What this means
A system call was interrupted by a signal before it could complete. The operation can be retried.
Why it happens
- 1Signal (e.g. SIGCHLD, SIGALRM) delivered during a blocking syscall
- 2Only relevant on Unix; rare in practice
Fix
Retry loop
Retry loop
use std::io::{Read, ErrorKind};
loop {
match reader.read(&mut buf) {
Err(e) if e.kind() == ErrorKind::Interrupted => continue,
r => return r,
}
}Why this works
Immediately retries on Interrupted; passes all other results to the caller.
Code examples
Noterust
// BufReader::read_line retries Interrupted internally
Same error in other languages
Sources
Official documentation ↗
Rust std::io
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev