diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2017-04-13 13:45:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 13:45:14 +0200 |
commit | 195fe4a475b7f35fba09af6126a205a959bb284d (patch) | |
tree | 6c63471c8645adb61166c560eb0313042502210c /compiler | |
parent | 742f881ddbc95669abe78aa76f7981fd0f821db6 (diff) | |
parent | 5b1ae606706e65aa3482367d6d2f30ae230bbadc (diff) | |
download | dotty-195fe4a475b7f35fba09af6126a205a959bb284d.tar.gz dotty-195fe4a475b7f35fba09af6126a205a959bb284d.tar.bz2 dotty-195fe4a475b7f35fba09af6126a205a959bb284d.zip |
Merge pull request #2252 from dotty-staging/fix/npe-in-cleanup-hook
Fix NPE when adding cleanup hook
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala index ad068e9ef..610466224 100644 --- a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala +++ b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala @@ -3,6 +3,7 @@ package tools package vulpix import java.io.{ File => JFile, InputStreamReader, BufferedReader, PrintStream } +import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.TimeoutException import scala.concurrent.duration.Duration @@ -84,11 +85,11 @@ trait RunnerOrchestration { } /** Did add hook to kill the child VMs? */ - private[this] var didAddCleanupCallback = false + private[this] val didAddCleanupCallback = new AtomicBoolean(false) /** Blocks less than `maxDuration` while running `Test.main` from `dir` */ def runMain(classPath: String)(implicit summaryReport: SummaryReporting): Status = { - if (!didAddCleanupCallback) { + if (didAddCleanupCallback.compareAndSet(false, true)) { // If for some reason the test runner (i.e. sbt) doesn't kill the VM, we // need to clean up ourselves. summaryReport.addCleanup(killAll) |