groovy-console

Stop Groovy console truncating output?


Is it possible to stop the Groovy console truncating output?

Using the 1.8.4 console, if I execute the following script:

for (i in 0..4000) println i

I get the following output:

01
602
603
...
3999
4000

I can't see any options to preserve all program output.


Solution

  • This file:

    https://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/groovy/ui/Console.groovy

    contains this code:

    // Maximum number of characters to show on console at any time
    int maxOutputChars = System.getProperty('groovy.console.output.limit','20000') as int
    

    Which seems to be the thing I want to change. There was even a JIRA on this:

    https://issues.apache.org/jira/browse/GROOVY-4425

    But so far I haven't been able to pass this property as a -D option through groovyConsole or groovyConsole.bat, the started console immediately closes. Will update if/when I figure out how to easily pass this property through to the console..