We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e572c0 commit a5ae0bdCopy full SHA for a5ae0bd
1 file changed
src/lib.rs
@@ -416,11 +416,16 @@ mod tests {
416
/// This is necessary because GitHub Actions opens a bunch of others for some reason.
417
fn close_excess_fds() {
418
let dir = read_dir("/proc/self/fd").unwrap();
419
- for entry in dir {
420
- let entry = entry.unwrap();
421
- let fd: RawFd = entry.file_name().to_str().unwrap().parse().unwrap();
+ let fds: Vec<RawFd> = dir
+ .map(|entry| {
+ let entry = entry.unwrap();
422
+ entry.file_name().to_str().unwrap().parse().unwrap()
423
+ })
424
+ .collect();
425
+ for fd in fds {
426
if fd > 2 {
- close(fd).unwrap();
427
+ // Ignore errors, as the file may already be closed.
428
+ let _ = close(fd);
429
}
430
431
0 commit comments