Skip to content

Commit 39717f1

Browse files
committed
Close Files.lines stream
Fixes #14376
1 parent f955f8b commit 39717f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/test/dotty/tools/utils.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ def assertThrows[T <: Throwable: ClassTag](p: T => Boolean)(body: => Any): Unit
4747
end assertThrows
4848

4949
def toolArgsFor(files: List[JPath], charset: Charset = UTF_8): List[String] =
50-
files.flatMap(path => toolArgsParse(Files.lines(path, charset).limit(10).toScala(List)))
50+
files.flatMap(path => toolArgsParse {
51+
val stream = Files.lines(path, charset)
52+
try stream.limit(10).toScala(List)
53+
finally stream.close()
54+
})
5155

5256
// Inspect the first 10 of the given lines for compiler options of the form
5357
// `// scalac: args`, `/* scalac: args`, ` * scalac: args`.

0 commit comments

Comments
 (0)