Skip to content

Commit 34b04d4

Browse files
committed
Be more paranoid about closing files
1 parent f4960d1 commit 34b04d4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,11 @@ object DottyIDEPlugin extends AutoPlugin {
186186
.replace("-nonbootstrapped", "") // The language server is only published bootstrapped
187187
val dlsBinaryVersion = dlsVersion.split("\\.").take(2).mkString(".")
188188
val pwArtifact = new PrintWriter(".dotty-ide-artifact")
189-
pwArtifact.println(s"ch.epfl.lamp:dotty-language-server_${dlsBinaryVersion}:${dlsVersion}")
190-
pwArtifact.close()
189+
try {
190+
pwArtifact.println(s"ch.epfl.lamp:dotty-language-server_${dlsBinaryVersion}:${dlsVersion}")
191+
} finally {
192+
pwArtifact.close()
193+
}
191194

192195
val mapper = new ObjectMapper
193196
mapper.writerWithDefaultPrettyPrinter()

0 commit comments

Comments
 (0)