cbt
cbt copied to clipboard
java.io.Console does not work via nailgun
java.io.Console is null when running via nailgun, but it is what is usually used to allow interactive input, as we need for gpg, repl, clean, etc. Currently all of those require cbt direct in order to work.
I see several possible solutions. Either we use something other than Console, which works with nailgun. This probably requires writing an abstraction over Console and whatever the nailgun equivalent is. CBT, plugins and potentially even project code would use the abstraction instead of the jdk built-in concepts. This obviously requires the application to be aware of this and run against the wrapper instead of directly against the jdk. This may be fine for CBT+plugins, but likely infeasible for applications compiled with CBT or simply used by CBT or CBT projects, such as the Scala repl.
Alternatively we could investigate if things like https://github.com/ninjudd/drip solve this better.
Or we could investigate if we could highjack/monkey-patch JDK built-ins by wrapper proxy's that redirect to Nailgun equivalents if necessary and otherwise use the actial JDK built-ins.
Currently the workaround is calling cbt tasks that require this via the direct
meta task, e.g. cbt direct publishSigned
, so that java.io.Console is available.
We may be able to use System.in instead of console
we use in, out and err provided by NGContext for I/O. Also see https://github.com/cvogt/cbt/issues/197
This may help: http://illegalargumentexception.blogspot.com/2010/09/java-systemconsole-ides-and-testing.html
java.io.Console
is null
also when you pipe output of cbt
like cbt run | less
without nailgun. So, you run into this problem each time you have several main
s and run cbt run
piped.