Skip to content

Commit

Permalink
fix: #1048 fixed the threads leak following #1027
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-eric-torreborre committed Jan 13, 2022
1 parent a7666f3 commit 2772dac
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,31 @@ package core
import control._
import io.FileSystem
import main.Arguments
import reporter.LineLogger.NoLineLogger
import reporter._, LineLogger._
import specification.process._
import concurrent._
import reflect._

object EnvDefault {

def default: Env =
create(Arguments(), consoleLogger)

def create(arguments: Arguments, lineLogger: LineLogger): Env =
Env(
arguments = Arguments(),
arguments = arguments,
systemLogger = consoleLogging,
selectorInstance = (arguments: Arguments) => DefaultSelector,
executorInstance = (arguments: Arguments) => DefaultExecutor,
lineLogger = NoLineLogger,
lineLogger = lineLogger,
statsRepository = (arguments: Arguments) => StatisticsRepositoryCreation.memory,
random = new scala.util.Random,
fileSystem = new FileSystem {},
executionParameters = ExecutionParameters(),
customClassLoader = None,
classLoading = new ClassLoading {}
)
classLoading = new ClassLoading {},
executionEnv = ExecutionEnv.create(arguments, consoleLogging),
specs2ExecutionEnv = ExecutionEnv.createSpecs2(arguments, consoleLogging))

def defaultInstances(env: Env) =
List[AnyRef](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,36 @@ package org.specs2
package specification
package core

import org.specs2.control.consoleLogging
import org.specs2.control._
import org.specs2.io.FileSystem
import org.specs2.io._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.main.Arguments
import org.specs2.reflect.ClassLoading
import org.specs2.reporter.LineLogger.NoLineLogger
import org.specs2.reporter._, LineLogger._
import org.specs2.specification.process._

object EnvDefault {

def default: Env =
create(Arguments(), consoleLogger)

def create(arguments: Arguments, lineLogger: LineLogger): Env =
Env(
arguments = Arguments(),
systemLogger = consoleLogging,
arguments = arguments,
systemLogger = consoleLogging,
selectorInstance = (arguments: Arguments) => Arguments.instance(arguments.select.selector).getOrElse(DefaultSelector),
executorInstance = (arguments: Arguments) => Arguments.instance(arguments.execute.executor).getOrElse(DefaultExecutor),
lineLogger = NoLineLogger,
lineLogger = lineLogger,
statsRepository = (arguments: Arguments) => StatisticsRepositoryCreation.file(arguments.commandLine.directoryOr("stats.outdir", "target" / "specs2-reports" / "stats")),
random = new scala.util.Random,
fileSystem = FileSystem,
executionParameters = ExecutionParameters(),
customClassLoader = None,
classLoading = new ClassLoading {})
classLoading = new ClassLoading {},
executionEnv = ExecutionEnv.create(arguments, consoleLogging),
specs2ExecutionEnv = ExecutionEnv.createSpecs2(arguments, consoleLogging)
)

def defaultInstances(env: Env) =
List[AnyRef](env.arguments.commandLine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ trait ClassRunner {
val arguments = Arguments(args.drop(1): _*)
arguments.reportUnknown()

val env = Env(arguments = arguments, lineLogger = consoleLogger)
val env = EnvDefault.create(arguments, consoleLogger)

val actions: Action[Stats] = args.toList match {
case Nil =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ case class Env(

/** set new arguments */
def setArguments(args: Arguments) =
copy(arguments = args,
executionEnv = ExecutionEnv.create(args, systemLogger),
specs2ExecutionEnv = ExecutionEnv.createSpecs2(args, systemLogger))
copy(arguments = args)

/** @return an isolated env */
def setWithIsolation =
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ThisBuild / version := "4.13.1"
ThisBuild / version := "4.13.2"
ThisBuild / versionScheme := Some("semver-spec")

0 comments on commit 2772dac

Please sign in to comment.