Repository: scala-steward-org/scala-steward
Pull request #1709 (2020-11-02 22:41:50)

Set sbt properties to disable colors and the supershell
See https://github.com/scala-steward-org/scala-steward/pull/1705#issuecomment-720760147 and #1698.


Patch:
diff --git a/modules/core/src/main/scala/org/scalasteward/core/buildtool/sbt/SbtAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/buildtool/sbt/SbtAlg.scala
index ce5386ce..5c8f4401 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/buildtool/sbt/SbtAlg.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/buildtool/sbt/SbtAlg.scala
@@ -104,10 +104,17 @@ object SbtAlg {
       val sbtDir: F[File] =
         fileAlg.home.map(_ / ".sbt")
 
+      private val javaOpts: (String, String) =
+        "JAVA_OPTS" -> List(
+          "-Dsbt.color=false",
+          "-Dsbt.log.noformat=true",
+          "-Dsbt.supershell=false"
+        ).mkString(" ")
+
       def sbt(sbtCommands: Nel[String], repoDir: File): F[List[String]] =
         maybeIgnoreOptsFiles(repoDir) {
           val command = Nel.of("sbt", sbtCommands.mkString_(";", ";", ""))
-          processAlg.execSandboxed(command, repoDir)
+          processAlg.execSandboxed(command, repoDir, javaOpts)
         }
 
       def maybeIgnoreOptsFiles[A](dir: File)(fa: F[A]): F[A] =


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/buildtool/BuildToolDispatcherTest.scala b/modules/core/src/test/scala/org/scalasteward/core/buildtool/BuildToolDispatcherTest.scala
index 5d5f6da1..a164600d 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/buildtool/BuildToolDispatcherTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/buildtool/BuildToolDispatcherTest.scala
@@ -30,6 +30,7 @@ class BuildToolDispatcherTest extends AnyFunSuite with Matchers {
           repoDir.toString,
           "firejail",
           s"--whitelist=$repoDir",
+          "--env=JAVA_OPTS=-Dsbt.color=false -Dsbt.log.noformat=true -Dsbt.supershell=false",
           "--env=VAR1=val1",
           "--env=VAR2=val2",
           "sbt",
diff --git a/modules/core/src/test/scala/org/scalasteward/core/buildtool/sbt/SbtAlgTest.scala b/modules/core/src/test/scala/org/scalasteward/core/buildtool/sbt/SbtAlgTest.scala
index e4f7290e..cb4d0e58 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/buildtool/sbt/SbtAlgTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/buildtool/sbt/SbtAlgTest.scala
@@ -42,6 +42,7 @@ class SbtAlgTest extends AnyFunSuite with Matchers {
           repoDir.toString,
           "firejail",
           s"--whitelist=$repoDir",
+          "--env=JAVA_OPTS=-Dsbt.color=false -Dsbt.log.noformat=true -Dsbt.supershell=false",
           "--env=VAR1=val1",
           "--env=VAR2=val2",
           "sbt",
@@ -75,6 +76,7 @@ class SbtAlgTest extends AnyFunSuite with Matchers {
           repoDir.toString,
           "firejail",
           s"--whitelist=$repoDir",
+          "--env=JAVA_OPTS=-Dsbt.color=false -Dsbt.log.noformat=true -Dsbt.supershell=false",
           "--env=VAR1=val1",
           "--env=VAR2=val2",
           "sbt",
@@ -110,6 +112,7 @@ class SbtAlgTest extends AnyFunSuite with Matchers {
           repoDir.toString,
           "firejail",
           s"--whitelist=$repoDir",
+          "--env=JAVA_OPTS=-Dsbt.color=false -Dsbt.log.noformat=true -Dsbt.supershell=false",
           "--env=VAR1=val1",
           "--env=VAR2=val2",
           "sbt",