summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/reflect/scala/reflect/io/Streamable.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/io/Streamable.scala b/src/reflect/scala/reflect/io/Streamable.scala
index 6184c6776a..1d51ad7f54 100644
--- a/src/reflect/scala/reflect/io/Streamable.scala
+++ b/src/reflect/scala/reflect/io/Streamable.scala
@@ -106,7 +106,10 @@ object Streamable {
/** Convenience function to import entire file into a String.
*/
def slurp(): String = slurp(creationCodec)
- def slurp(codec: Codec) = chars(codec).mkString
+ def slurp(codec: Codec) = {
+ val src = chars(codec)
+ try src.mkString finally src.close() // Always Be Closing
+ }
}
/** Call a function on something Closeable, finally closing it. */