JLine 2.0 loads the -Djline.terminal=<class> option from the context loader, so set that in the launcher

This commit is contained in:
Mark Harrah 2013-06-20 16:55:42 -04:00
parent 26a0692fd3
commit 1a3ea6fb8b
1 changed files with 7 additions and 1 deletions

View File

@ -52,7 +52,7 @@ object Launch
val appConfig: xsbti.AppConfiguration = new AppConfiguration(toArray(arguments), workingDirectory, appProvider)
val main = appProvider.newMain()
try { main.run(appConfig) }
try { withContextLoader(appProvider.loader)(main.run(appConfig)) }
catch { case e: xsbti.FullReload => if(e.clean) delete(launcher.bootDirectory); throw e }
}
final def launch(run: RunConfiguration => xsbti.MainResult)(config: RunConfiguration): Option[Int] =
@ -65,6 +65,12 @@ object Launch
case x => throw new BootException("Invalid main result: " + x + (if(x eq null) "" else " (class: " + x.getClass + ")"))
}
}
private[this] def withContextLoader[T](loader: ClassLoader)(eval: => T): T =
{
val oldLoader = Thread.currentThread.getContextClassLoader
Thread.currentThread.setContextClassLoader(loader)
try { eval } finally { Thread.currentThread.setContextClassLoader(oldLoader) }
}
}
final class RunConfiguration(val scalaVersion: Option[String], val app: xsbti.ApplicationID, val workingDirectory: File, val arguments: List[String])