From d8609ced7feb3ae8b878958d01632064806bc1d0 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Wed, 20 Dec 2017 22:36:07 -0500 Subject: [PATCH 1/2] formatting --- main/src/main/scala/sbt/internal/CommandExchange.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/internal/CommandExchange.scala b/main/src/main/scala/sbt/internal/CommandExchange.scala index acbe78bb6..99f1e1418 100644 --- a/main/src/main/scala/sbt/internal/CommandExchange.scala +++ b/main/src/main/scala/sbt/internal/CommandExchange.scala @@ -156,7 +156,8 @@ private[sbt] final class CommandExchange { // rememeber to shutdown only when the server comes up server = Some(x) case Some(Failure(e: AlreadyRunningException)) => - s.log.warn("sbt server could not start because there's another instance of sbt running on this build.") + s.log.warn( + "sbt server could not start because there's another instance of sbt running on this build.") s.log.warn("Running multiple instances is unsupported") server = None firstInstance.set(false) From 13e1862c2f12f633b13d4b68715d933fef8baf31 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 21 Dec 2017 00:08:56 -0500 Subject: [PATCH 2/2] set jna.nosys to true programmatically Previously I was seeing the error upon the first scripted test. I thought it was because Main was somehow not early enough. It might just be because scripted technically runs as part of the build. Ref sbt/io#110 --- .appveyor.yml | 2 +- build.sbt | 2 +- main/src/main/scala/sbt/Main.scala | 3 +++ project/Scripted.scala | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0b15d875f..b9a894ee2 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -20,4 +20,4 @@ install: - SET PATH=C:\sbt\sbt\bin;%PATH% - SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g -Dfile.encoding=UTF8 test_script: - - sbt "-Djna.nosys=true" "scripted actions/*" + - sbt "scripted actions/*" diff --git a/build.sbt b/build.sbt index 8000bd603..dcedffd62 100644 --- a/build.sbt +++ b/build.sbt @@ -572,7 +572,7 @@ def otherRootSettings = scriptedUnpublished := scriptedUnpublishedTask.evaluated, scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test", // scriptedPrescripted := { addSbtAlternateResolver _ }, - scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server", "-Djna.nosys=true"), + scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server"), publishAll := { val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value }, publishLocalBinAll := { val _ = (publishLocalBin).all(ScopeFilter(inAnyProject)).value }, aggregate in bintrayRelease := false diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index 6c605056e..da44d0cb8 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -128,6 +128,9 @@ object StandardMain { def initialState(configuration: xsbti.AppConfiguration, initialDefinitions: Seq[Command], preCommands: Seq[String]): State = { + // This is to workaround https://github.com/sbt/io/issues/110 + sys.props.put("jna.nosys", "true") + import BasicCommandStrings.isEarlyCommand val userCommands = configuration.arguments.map(_.trim) val (earlyCommands, normalCommands) = (preCommands ++ userCommands).partition(isEarlyCommand) diff --git a/project/Scripted.scala b/project/Scripted.scala index 932d55a0f..788f1d60e 100644 --- a/project/Scripted.scala +++ b/project/Scripted.scala @@ -37,6 +37,9 @@ trait ScriptedKeys { } object Scripted { + // This is to workaround https://github.com/sbt/io/issues/110 + sys.props.put("jna.nosys", "true") + lazy val MavenResolverPluginTest = config("mavenResolverPluginTest") extend Compile lazy val RepoOverrideTest = config("repoOverrideTest") extend Compile