Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip -J prefix of jvm arguments before forking #1085

Merged
merged 1 commit into from Nov 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions frontend/src/main/scala/bloop/exec/JvmProcessForker.scala
Expand Up @@ -53,7 +53,8 @@ trait JvmProcessForker {
extraClasspath: Array[AbsolutePath] = Array.empty
): Task[Int] = {
val (userJvmOptions, userArgs) =
if (skipJargs) (Array.empty[String], args0) else args0.partition(_.startsWith("-J"))
if (skipJargs) (Array.empty[String], args0)
else args0.partition(_.startsWith("-J"))

runMain(cwd, mainClass, userArgs, userJvmOptions, logger, opts, extraClasspath)
}
Expand Down Expand Up @@ -111,7 +112,7 @@ final class JvmForker(config: JdkConfig, classpath: Array[AbsolutePath]) extends
opts: CommonOptions,
extraClasspath: Array[AbsolutePath]
): Task[Int] = {
val jvmOptions = jargs ++ config.javaOptions
val jvmOptions = jargs.map(_.stripPrefix("-J")) ++ config.javaOptions
val fullClasspath = (classpath ++ extraClasspath).map(_.syntax).mkString(pathSeparator)
Task.fromTry(javaExecutable).flatMap { java =>
val classpathOption = "-cp" :: fullClasspath :: Nil
Expand Down Expand Up @@ -149,13 +150,13 @@ final class JvmDebuggingForker(underlying: JvmProcessForker) extends JvmProcessF
cwd: AbsolutePath,
mainClass: String,
args: Array[String],
jargs: Array[String],
jargs0: Array[String],
logger: Logger,
opts: CommonOptions,
extraClasspath: Array[AbsolutePath]
): Task[Int] = {
val jvmOptions = jargs :+ enableDebugInterface
underlying.runMain(cwd, mainClass, args, jvmOptions, logger, opts, extraClasspath)
val jargs = jargs0 :+ enableDebugInterface
underlying.runMain(cwd, mainClass, args, jargs, logger, opts, extraClasspath)
}

private def enableDebugInterface: String = {
Expand Down