aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Waterman2016-08-08 12:28:21 -0700
committerAndrew Waterman2016-08-08 12:28:21 -0700
commitc7a97719e9de236d569a0e40abd5a3cd122dd5a5 (patch)
treeefac79ae9eb27ebefacc1fae2bae1a3f0f5ffc21 /src
parentfa0573f657f722b1a163ce721f06172a1a9782c2 (diff)
Don't create output files until the compiler succeeds
Creating the output file preemptively screws up make, as on subsequent executions of make, it thinks the task succeeded.
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/firrtl/Driver.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/scala/firrtl/Driver.scala b/src/main/scala/firrtl/Driver.scala
index bd7210f4..1a72746d 100644
--- a/src/main/scala/firrtl/Driver.scala
+++ b/src/main/scala/firrtl/Driver.scala
@@ -27,7 +27,6 @@ MODIFICATIONS.
package firrtl
-import java.io.{PrintWriter, Writer, File}
import scala.io.Source
import scala.collection.mutable
import Annotations._
@@ -57,9 +56,12 @@ Options:
infoMode: InfoMode = IgnoreInfo,
annotations: AnnotationMap = new AnnotationMap(Seq.empty)) = {
val parsedInput = Parser.parse(Source.fromFile(input).getLines, infoMode)
- val writerOutput = new PrintWriter(new File(output))
- compiler.compile(parsedInput, annotations, writerOutput)
- writerOutput.close
+ val outputBuffer = new java.io.CharArrayWriter
+ compiler.compile(parsedInput, annotations, outputBuffer)
+
+ val outputFile = new java.io.PrintWriter(output)
+ outputFile.write(outputBuffer.toString)
+ outputFile.close()
}
/**