Hi I’m using kotlin script engine in a webapp to b...
# scripting
f
Hi I’m using kotlin script engine in a webapp to build PoC, I’d like to know is it possible to redirect the stdout to a string buffer or
StringWriter
directly?? I’ve tried to set the
scriptEngine.context.writer
but it seems not working.
i
Hi! You can do it only via
System.setOut
, etc., since we do not intercept io on the compilation to allow any other approach. The
scriptEngine.context.writer
is not implemented because
Sysstem.setOut
is the only way to do it, and we assume that the user knows better his environment to implement a specific solution - it is difficult to make a good general one.
f
Thanks! It's working!