slachiewicz opened a new pull request, #218:
URL: https://github.com/apache/maven-script-interpreter/pull/218

   Fixes #205. Both interpreters did `System.setOut/setErr(scriptOutput)` 
around an evaluation, which is why `ScriptRunner` serialised every run in the 
JVM behind a static lock and why a concurrent thread's output ended up in the 
script's `build.log`.
   
   Now `ScriptOutputRedirect` swaps the process streams once, while at least 
one script runs, for a stream that forwards each call to the redirect 
registered for the calling thread (an `InheritableThreadLocal`, so threads a 
script spawns follow it) or to the original stream when there is none; the last 
redirect to close puts the originals back. Calls are forwarded whole rather 
than as bytes, so `FileLogger`, which mirrors a line per flush, sees the same 
line boundaries as before. Groovy additionally gets the log bound as `out`, 
which is where a script's `println` goes. The static lock is gone.
   
   Stacked on #217.
   
   Verified: 36 tests green, including a new one running two scripts 
concurrently through a barrier while a third thread prints: each log holds only 
its own script's `println`/`System.out`/`System.err` lines, the bystander's 
line reaches the real stream, and `System.out` is the original object again 
afterwards.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to