My output from exec seems to be being flushed wrong

I’m noticing what seems to be 2 categories of problems with output when using gradle to run something with an exec task that doesn’t happen if I just run it without gradle. Here is a .zip that has screenshots labeled with a number and description so you can see what I mean.

  1. Issues with spacing (#1), foreign characters (#2) and color changes (#3). I don’t see these if I use -q or I redirect the streams to a different bytearrayoutput stream and print it out.

  2. Std err isn’t being placed at the right point relative to std out. It’s scattered somewhere in the output (#4). With -q or printing via a different stream it is more firmly grouped (#5), but still not in the right place (#6) We do flush the stream after each logging message so stdout is being flushed atleast after the verbose,info,and debug messages and stderr after the warn error and fatal messages.