Domanda

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.

È stato utile?

Soluzione 2

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..

Altri suggerimenti

Expanding upon the accepted answer, groovyconsole uses JAVA_OPTS, so anything you set in there will be picked up. For instance, if you wanted to increase the max memory to 4 GB and the console limit to 200,000, then you could do this statement prior to running groovyConsole:

export JAVA_OPTS="-Xmx4096m -Dgroovy.console.output.limit=200000"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top