Fix #8441: Allow system JNA on OpenBSD by making jna.nosys conditional

This commit is contained in:
calm329 2026-01-08 13:47:42 -08:00 committed by calm
parent 997ad9619a
commit 1054ee851e
3 changed files with 4 additions and 3 deletions

View File

@ -61,6 +61,7 @@ private[sbt] object xMain:
private[sbt] def run(configuration: xsbti.AppConfiguration): xsbti.MainResult = boundary {
try {
if (!sys.props.contains("jna.nosys")) sys.props.put("jna.nosys", "true")
import BasicCommandStrings.{ JavaClient, DashDashClient, DashDashServer, runEarly }
import BasicCommands.early
import BuiltinCommands.defaults
@ -265,7 +266,7 @@ object StandardMain {
preCommands: Seq[String]
): State = {
// This is to workaround https://github.com/sbt/io/issues/110
sys.props.put("jna.nosys", "true")
if (!sys.props.contains("jna.nosys")) sys.props.put("jna.nosys", "true")
import BasicCommandStrings.{ DashDashDetachStdio, DashDashServer, isEarlyCommand }
val userCommands =

View File

@ -25,7 +25,7 @@ trait ScriptedKeys {
object Scripted {
// This is to workaround https://github.com/sbt/io/issues/110
sys.props.put("jna.nosys", "true")
if (!sys.props.contains("jna.nosys")) sys.props.put("jna.nosys", "true")
val RepoOverrideTest = config("repoOverrideTest") extend Compile

View File

@ -56,7 +56,7 @@ object RunFromSourceMain {
s"Must specify working directory, scala version and sbt version and classpath as the first three arguments"
)
case Array(wd, scalaVersion, sbtVersion, classpath, args*) =>
System.setProperty("jna.nosys", "true")
if (System.getProperty("jna.nosys") == null) System.setProperty("jna.nosys", "true")
if (args.exists(_.startsWith("<"))) System.setProperty("sbt.io.virtual", "false")
val context = LoggerContext()
try run(file(wd), scalaVersion, sbtVersion, classpath, args, context)