elharo commented on PR #412:
URL: 
https://github.com/apache/maven-shared-utils/pull/412#issuecomment-5165615736

   Thanks for the detailed review — the probe reproducing the ~10% spurious 
'Failure processing stdout' on a cleanly-exiting process was very helpful. I've 
merged master into this branch and reworked the close into a fallback as 
suggested:
   
   * The process streams are no longer closed unconditionally. After 
`waitFor()` the pumpers are first given a grace period 
(`STREAM_EOF_GRACE_PERIOD_MS = 5000`) to drain the remaining output and reach 
EOF on their own (the common case, as on master). Only if they are still stuck 
after the grace period do we force EOF by closing the streams.
   * Before forcing the close, both pumpers are marked with the existing 
`disable()` hook, and `StreamPumper.run()` now treats an `IOException` as EOF 
when disabled, so the close no longer gets recorded as a stdout/stderr failure.
   * Added a timeout-aware `AbstractStreamHandler.waitUntilDone(long)` for the 
grace-period wait (plus unit tests for it).
   * Added a regression test 
(`executeCommandLineWithLargeStdoutCompletesWithoutFailure`) based on your 
probe: it runs `seq` via `executeCommandLine` repeatedly and asserts exit code 
0, complete output, and no exception. I verified it reproduces the spurious 
`CommandLineException` against the previous unconditional-close code and stays 
green with the fallback. It is Unix-only (`seq`) and skipped elsewhere.
   
   The PR is now up to date with master and green on the matrix. Happy to 
adjust the grace-period value or anything else.


-- 
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