问题
I'm running SBT under chef-solo, and it hangs trying to read from the terminal. Redirecting /dev/null
into it doesn't help, even if I run the jar directly with java. It only works if I orphan it, and will only terminate when the parent chef-solo terminates. It must be closing stdin, and then reopening it, thus getting the stdin of the parent. The stack trace during the hang seems to indicate that. I suspect it has something to do with one of the plugins
Thread 22379: (state = IN_NATIVE)
- java.io.FileInputStream.readBytes(byte[], int, int) @bci=0 (Interpreted frame)
- java.io.FileInputStream.read(byte[], int, int) @bci=16, line=272 (Interpreted frame)
- java.io.BufferedInputStream.fill() @bci=175, line=235 (Interpreted frame)
- java.io.BufferedInputStream.read() @bci=12, line=254 (Interpreted frame)
- jline.internal.TerminalLineSettings.exec(java.lang.String[]) @bci=54, line=191 (Interpreted frame)
- jline.internal.TerminalLineSettings.exec(java.lang.String) @bci=26, line=173 (Interpreted frame)
- jline.internal.TerminalLineSettings.stty(java.lang.String) @bci=26, line=168 (Interpreted frame)
- jline.internal.TerminalLineSettings.set(java.lang.String) @bci=2, line=76 (Interpreted frame)
- jline.UnixTerminal.init() @bci=15, line=54 (Interpreted frame)
- jline.TerminalFactory.create() @bci=298, line=101 (Interpreted frame)
- jline.TerminalFactory.get() @bci=14, line=159 (Interpreted frame)
- sbt.ConsoleLogger$.ansiSupported() @bci=0, line=123 (Interpreted frame)
- sbt.ConsoleLogger$.<init>() @bci=21, line=117 (Interpreted frame)
- sbt.ConsoleLogger$.<clinit>() @bci=3 (Interpreted frame)
- sbt.GlobalLogging$.initial(scala.Function2, scala.Function0, sbt.ConsoleOut) @bci=0, line=43 (Interpreted frame)
- sbt.StandardMain$.initialGlobalLogging() @bci=24, line=60 (Interpreted frame)
- sbt.StandardMain$.initialState(xsbti.AppConfiguration, scala.collection.Seq, scala.collection.Seq) @bci=205, line=69 (Interpreted frame)
- sbt.xMain.run(xsbti.AppConfiguration) @bci=97, line=28 (Interpreted frame)
- xsbt.boot.Launch$$anonfun$run$1.apply() @bci=10, line=109 (Interpreted frame)
- xsbt.boot.Launch$.withContextLoader(java.lang.ClassLoader, scala.Function0) @bci=15, line=128 (Interpreted frame)
- xsbt.boot.Launch$.run(xsbti.Launcher, xsbt.boot.RunConfiguration) @bci=97, line=109 (Interpreted frame)
- xsbt.boot.Launch$$anonfun$apply$1.apply(java.lang.Object) @bci=16, line=35 (Interpreted frame)
- xsbt.boot.Launch$.launch(scala.Function1, xsbt.boot.RunConfiguration) @bci=2, line=117 (Interpreted frame)
- xsbt.boot.Launch$.apply(xsbt.boot.LauncherArguments) @bci=876, line=18 (Interpreted frame)
- xsbt.boot.Boot$.runImpl(xsbt.boot.LauncherArguments) @bci=4, line=41 (Interpreted frame)
- xsbt.boot.Boot$.main(java.lang.String[]) @bci=291, line=17 (Interpreted frame)
- xsbt.boot.Boot.main(java.lang.String[]) @bci=4 (Interpreted frame)
回答1:
Well, after much digging, this should work but doesn't
-Dsbt.log.noformat=true
So I dug into the jline website and found this disables interrogating the terminal
-Djline.terminal=jline.UnsupportedTerminal
来源:https://stackoverflow.com/questions/29911077/sbt-hangs-when-running-with-chef-solo