how to enable `\r` in TerminalExecutionConsole when running commands which don't output `\r`

I'm working on an IDEA plugin for Jenkins X: and we're trying to open an interactive terminal using TerminalExecutionConsole which kinda works:

However the output never generates any `/r` characters so things wrap oddly in the UI (see below). I wonder if anyone had any bright ideas on how to configure the TerminalExecutionConsole / OSProcessHandler to deal with this? Note that the command being run is a go binary which doesn't appear to output `\r` but just `\n` for newlines. 

1 comment

In my case the problem was not that the process didn't output `\r` (though I don't remember outputting it), but that the default settings of `OSProcessHandler` was actively removing them. I have fixed this by overriding `OSProcessHandler.readerOptions()` to return:

override fun splitToLines(): Boolean = false

override fun sendIncompleteLines(): Boolean = true

override fun policy(): BaseDataReader.SleepingPolicy = BaseDataReader.SleepingPolicy.BLOCKING

override fun withSeparators(): Boolean = true

Initially I have implemented a special readers which replace `\n` with `\r\n`, but I didn't use that after all. The full code is here, if anybody is interested.


Please sign in to leave a comment.