We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 690564c commit f32147bCopy full SHA for f32147b
1 file changed
src/lib.rs
@@ -400,11 +400,16 @@ mod tests {
400
/// This is necessary because GitHub Actions opens a bunch of others for some reason.
401
fn close_excess_fds() {
402
let dir = read_dir("/proc/self/fd").unwrap();
403
- for entry in dir {
404
- let entry = entry.unwrap();
405
- let fd: RawFd = entry.file_name().to_str().unwrap().parse().unwrap();
+ let fds: Vec<RawFd> = dir
+ .map(|entry| {
+ let entry = entry.unwrap();
406
+ entry.file_name().to_str().unwrap().parse().unwrap()
407
+ })
408
+ .collect();
409
+ for fd in fds {
410
if fd > 2 {
- close(fd).unwrap();
411
+ // Ignore errors, as the file may already be closed.
412
+ let _ = close(fd);
413
}
414
415
0 commit comments