Permalink
Browse files

Make the launcher initialize Jansi if it's found on the path

  • Loading branch information...
szeiger committed Jan 11, 2012
1 parent 1e47d72 commit a8d34befb8cfff7da50d7f583a2159c460998813
Showing with 13 additions and 0 deletions.
  1. +13 −0 launch/Boot.scala
View
@@ -12,6 +12,7 @@ object Boot
{
System.clearProperty("scala.home") // avoid errors from mixing Scala versions in the same JVM
CheckProxy()
+ initJansi()
run(args)
}
// this arrangement is because Scala 2.7.7 does not properly optimize away
@@ -40,4 +41,16 @@ object Boot
}
private def exit(code: Int): Nothing =
System.exit(code).asInstanceOf[Nothing]
+
+ private def initJansi() {
+ try {
+ val c = Class.forName("org.fusesource.jansi.AnsiConsole")
+ c.getMethod("systemInstall").invoke(null)
+ if(System.getProperty("sbt.log.format") eq null)
+ System.setProperty("sbt.log.format", "true")
+ } catch {
+ case ignore: ClassNotFoundException =>
+ case ex => println("Jansi found on class path but initialization failed: "+ex)
+ }
+ }
}

0 comments on commit a8d34be

Please sign in to comment.