Skip to content

Commit

Permalink
Ensure source files are closed
Browse files Browse the repository at this point in the history
closes GH-148
  • Loading branch information
hrj committed May 10, 2017
1 parent 0e40ce5 commit bc67e00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions base/src/main/scala/co/uproot/abandon/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ class AbandonParser(inputPathOpt: Option[String]) extends StandardTokenParsers w
new lexical.Scanner(reader)
}

def scannerFromFile(filePath:String) = {
val reader= new PagedSeqReader(PagedSeq.fromFile(filePath))
def scannerFromSource(source:io.Source) = {
val reader= new PagedSeqReader(PagedSeq.fromIterator(source))
new lexical.Scanner(reader)
}
}
Expand Down
2 changes: 1 addition & 1 deletion base/src/main/scala/co/uproot/abandon/Process.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ object Processor {
case Some(source) =>
val parser = new AbandonParser(Some(inputPath))

val parseResult = parser.abandon(Option(input.parentScope))(parser.scannerFromFile(inputPath))
val parseResult = parser.abandon(Option(input.parentScope))(parser.scannerFromSource(source))
parseResult match {
case parser.Success(scope, _) =>
val includes = filterByType[IncludeDirective](scope.entries)
Expand Down

0 comments on commit bc67e00

Please sign in to comment.