RFR: 8303133: Update ProcessTools.startProcess(...) to exit early if process exit before linePredicate is printed. [v4]
David Holmes
dholmes at openjdk.org
Mon Feb 27 22:56:35 UTC 2023
On Mon, 27 Feb 2023 22:12:22 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:
>> The solution proposed by Stefan K
>>
>> The startProcess() might wait forever for the expected line if the process exits (failed to start). It makes sense to just fail earlier in such cases.
>>
>> The fix also move
>> 'output = new OutputAnalyzer(this.process);'
>> in method xrun() to be able to try to print them in waitFor is failed/interrupted.
>
> Leonid Mesnik has updated the pull request incrementally with one additional commit since the last revision:
>
> added some extra time to dead process.
test/lib/jdk/test/lib/process/ProcessTools.java line 227:
> 225: // Give some extra time for the StreamPumper to run after the process completed
> 226: Thread.sleep(1000);
> 227: if (latch.getCount() > 0) {
Nit: we use > 0 here but != 0 above.
test/lib/jdk/test/lib/process/ProcessTools.java line 228:
> 226: Thread.sleep(1000);
> 227: if (latch.getCount() > 0) {
> 228: throw new RuntimeException("Started process " + name + " is not alive.");
Nit: the message is not very informative - we expect the process to die, the problem is it died before giving the necessary output. Suggestion:
> "Started process " + name + "terminated before producing the expected output"
-------------
PR: https://git.openjdk.org/jdk/pull/12751
More information about the core-libs-dev
mailing list