I'm working on a PreRepositoryHook plugin that performs static analysis on pushed code.
Sometimes the analysis takes a long time, so the output from the analysis should be sent and displayed to the user immediately without any buffering.
But If i use PrintWriter from ScmHookDetails like the followings, the output is buffered and displayed all at once after the analysis is finished.
ScmHookDetails scmDetails = request.getScmHookDetails().get();
PrintWriter out = scmDetails.out();
out.println(...);
out.println(...);
out.flush(); // doesn't work
out.println(...);
out.println(...)
output:
$ git push
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
... takes long time without any output ...
remote: ...
remote: ...
remote: ...
remote: ..
Is there any solution to this?