mcidasv/mcidasv — pull request #27 by mhiley (2013-03-28 17:51:02+00:00)
Title: Skip over write attempts of 8192 characters or longer, and don't buffer

First stab at fixing a couple Jython Shell issues:

(1) Don't print output to the Jython Shell or jython.log if the string exceeds a threshold of 8192 characters (this is the chunk size that the PythonInterpreter splits its output into, though I have no idea if that is consistent across platforms, etc.). This combats the problem of the Jython Shell "locking up" when a user prints a big data object. (Note, in this implementation the user isn't warned when the output is truncated…so far I can't think of a nice way to do this since they would be warned for every single 8192 character chunk that is skipped!).

(2) Don't buffer the text output. If you have a long script that is doing intensive calculations or downloading remote data, you want to see the output as soon as it's available, not wait until the entire script is done running. This one seemed to easy… I feel like I'm missing the rationale behind buffering the output in the first place.

Feel free to suggest/commit improvements or let me know if either of these are a fundamentally bad way of doing things!