REPL: print newline before exit
No tests added because the only way to test this seems to be to launch a new process and send "Ctrl+D" into it, which seems cumbersome for such small change
This commit is contained in:
@@ -17,6 +17,17 @@
|
|||||||
package org.jetbrains.kotlin.cli.jvm.repl.messages
|
package org.jetbrains.kotlin.cli.jvm.repl.messages
|
||||||
|
|
||||||
class ReplConsoleWriter : ReplWriter {
|
class ReplConsoleWriter : ReplWriter {
|
||||||
|
init {
|
||||||
|
Runtime.getRuntime().addShutdownHook(object : Thread("Kotlin REPL shutdown hook") {
|
||||||
|
override fun run() {
|
||||||
|
// Print an empty line to make the command prompt start from the beginning of the line after REPL exits.
|
||||||
|
// This is essentially a workaround of a jline2 bug.
|
||||||
|
// TODO: remove this as soon as we update to jline3
|
||||||
|
println()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
override fun printlnWelcomeMessage(x: String) = println(x)
|
override fun printlnWelcomeMessage(x: String) = println(x)
|
||||||
override fun printlnHelpMessage(x: String) = println(x)
|
override fun printlnHelpMessage(x: String) = println(x)
|
||||||
override fun outputCompileError(x: String) = println(x)
|
override fun outputCompileError(x: String) = println(x)
|
||||||
|
|||||||
Reference in New Issue
Block a user