Explorar o código

build: ensure file handles properly closed (#5298)

I've been running the test suite (`./internal/engine` in particular)
with `-count X` a lot recently to catch timing-related test failures.

After running enough times, the tests start failing due to too many
open files, so I did an audit and found a few places where files or
readers weren't always being closed.
Milas Bowman %!s(int64=4) %!d(string=hai) anos
pai
achega
6fc0b6ff27
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      pkg/watch/notify_test.go

+ 2 - 1
pkg/watch/notify_test.go

@@ -181,10 +181,11 @@ func TestNewDirectoriesAreRecursivelyWatched(t *testing.T) {
 
 	// change something inside sub directory
 	changeFilePath := filepath.Join(subPath, "change")
-	_, err := os.OpenFile(changeFilePath, os.O_RDONLY|os.O_CREATE, 0666)
+	file, err := os.OpenFile(changeFilePath, os.O_RDONLY|os.O_CREATE, 0666)
 	if err != nil {
 		t.Fatal(err)
 	}
+	_ = file.Close()
 	f.assertEvents(subPath, changeFilePath)
 }