Skip to content

Commit

Permalink
Fox #1246 flaky rpm tests (#1249)
Browse files Browse the repository at this point in the history
* WIP #1246 update to sbt 1.2.8

* printing the output buffer to see why travis fails

* Add try catch and explanation
  • Loading branch information
muuki88 authored Jul 12, 2019
1 parent 663498c commit 4f3ac34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.2.6
sbt.version=1.2.8
13 changes: 10 additions & 3 deletions src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,17 @@ object RpmHelper {
// RPM outputs to standard error in non-error cases. So just collect all the output, then dump
// it all to either error log or info log depending on the exit status
val outputBuffer = collection.mutable.ArrayBuffer.empty[String]
(sys.process.Process(args, Some(specsDir)) ! sys.process
.ProcessLogger(o => outputBuffer.append(o))) match {
sys.process.Process(args, Some(specsDir)) ! sys.process.ProcessLogger(o => outputBuffer.append(o)) match {
case 0 =>
outputBuffer.foreach(log.info(_))
// Workaround for #1246 - random tests fail with a NullPointerException in the sbt ConsoleLogger
// I wasn't able to reproduce this locally and there aren't any user reports on this, so we catch
// the NPE and log via println
try {
outputBuffer.foreach(log.info(_))
} catch {
case e: NullPointerException =>
outputBuffer.foreach(println(_))
}
case code =>
outputBuffer.foreach(log.error(_))
sys.error("Unable to run rpmbuild, check output for details. Errorcode " + code)
Expand Down

0 comments on commit 4f3ac34

Please sign in to comment.