data.json

clojure.data.json/pprint output might be cut off

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

From a question in irc[1].

When running a main from AOT'd class which uses clojure.data.json/pprint to print a large structure, the output may be cut off. It looks like clojure.data.json/pprint does not flush the stream when finished. For comparison, clojure.pprint/pprint adds a prn if it ends with a non endline.

Reproduction:

Download attached jsont.tgz.
tar -jxf jsont.tgz
cd jsont.tgz
lein uberjar
java -jar target/jsont-0.1.0-SNAPSHOT-standalone.jar

Current output:

[0, 1, 2, 3, ... 9599, 96
(output cut off after 96)

Expected output:

[0, 1, 2, 3, ... 9999]

Workaround: adding (flush) after (clojure.data.json/pprint ...) calls.

[1] http://clojure-log.n01se.net/date/2013-09-01.html#20:15
[2] https://github.com/clojure/clojure/blob/master/src/clj/clojure/pprint/pprint_base.clj#L252

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: