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