Hi Jaroslav,
That's exactly the functionality I've been looking for! Not only it will
solveJDK-8074041 the ProcessImpl will help me to solve
https://bugs.openjdk.java.net/browse/JDK-8073794 since I'll be able to
analyse out and err streams outside startProcess() function.
Best regards,
Katja (not a reviwer)
On 03/11/2015 09:35 AM, Jaroslav Bachorik wrote:
On 5.3.2015 11:37, Jaroslav Bachorik wrote:
Please, review the following change
Issue : https://bugs.openjdk.java.net/browse/JDK-8074041
Webrev: http://cr.openjdk.java.net/~jbachorik/8074041/webrev.00
This test fails very intermittently still and the failure is very hard
to reproduce. Based on the symptoms the probable cause seems to be the
asynchronous processing of a launched process stdout and stderr.
The test is using ProcessTools.startProcess(...) to start the target
process and process its output (stdout/stderr) to mark the occurrence of
the expected string. When the target process has finished the test will
check the mark to assert the correctness. However, it may happen that
the assertion occurs in the time interval between the target process
finishing (process.waitFor() returns) and the asynchronous stderr/stdout
processors had the chance to dispatch the target process output to the
processor checking for the occurrence of the expected test.
The proposed fix is to wrap the Process instance into a wrapper
enhancing the waitFor() method with the wait for the stdout/stderr
processor being finished before proceeding. I ran the test in a tight
loop for 1000 times after applying this patch without any failure.
Thanks,
-JB-