Output file erased if it exists, append allows outputLine

This commit is contained in:
Bruce Eckel 2016-07-18 17:34:08 -06:00
parent c26ff2bcfc
commit 86429d6d03

View File

@ -144,10 +144,12 @@ subprojects {
String basePath = it.absolutePath.replaceAll('\\.java', '')
File outFile = new File(basePath + '.out')
if(outFile.exists())
outFile.delete()
if(tags.outputLine)
outFile.write(tags.outputLine + "\n")
outFile << tags.outputLine + "\n"
File errFile = new File(basePath + '.err')
OutputStream runStandardOutput = new TeeOutputStream(new FileOutputStream(outFile), System.out)
OutputStream runStandardOutput = new TeeOutputStream(new FileOutputStream(outFile, true), System.out)
OutputStream runErrorOutput = new TeeOutputStream(new FileOutputStream(errFile), System.err)
task "$tags.fileRoot"(type: JavaExec, dependsOn: tags.runFirst) {