mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-15 15:44:04 +00:00
fix os.read_dir closing the given file descriptor
This commit is contained in:
@@ -32,7 +32,9 @@ read_dir :: proc(t: ^testing.T) {
|
||||
|
||||
fd, err := os.open(#directory + "/dir")
|
||||
testing.expect_value(t, err, nil)
|
||||
defer os.close(fd)
|
||||
defer {
|
||||
testing.expect_value(t, os.close(fd), nil)
|
||||
}
|
||||
|
||||
dir, err2 := os.read_dir(fd, -1)
|
||||
testing.expect_value(t, err2, nil)
|
||||
@@ -58,4 +60,4 @@ read_dir :: proc(t: ^testing.T) {
|
||||
testing.expect_value(t, dir[2].name, "sub")
|
||||
testing.expect(t, dir[2].is_dir, "is not a directory")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user