install

fun install(sink: (text: String, fromErr: Boolean) -> Unit)(source)

Install line-completing tees on System.out and System.err. The sink receives each completed line plus a flag indicating whether it came from stderr (fromErr = true) or stdout (fromErr = false).

If a capture is already installed when called, the previous one is replaced — its sink stops receiving lines and the new sink takes over from the next byte written.

Parameters

sink

callback that receives (text, fromErr) for each completed line. Invoked on the writer's thread; not guaranteed to be any particular dispatcher.