Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303486

[REDO] Update ProcessTools.startProcess(...) to exit early if process exit before linePredicate is printed.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 21
    • hotspot
    • None
    • b13

      It is the 2nd attempt to fix
      JDK-8303133 Update ProcessTools.startProcess(...) to exit early if process exit before linePredicate is printed.

      The first fix failed because it run
      Utils.waitForCondition(BooleanSupplier condition, long timeout, long sleepTime) { ..}
      with 0 as no timeout and not -1 as required.

      Might it is needed to update waitForCondition to us 0 for this to be java compliant.

      the additional diff is:
      diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java
      index 33f326f27e5..a7de64ca2ed 100644
      --- a/test/lib/jdk/test/lib/process/ProcessTools.java
      +++ b/test/lib/jdk/test/lib/process/ProcessTools.java
      @@ -216,9 +216,11 @@ public final class ProcessTools {

               try {
                   if (timeout > -1) {
      +
      + long timeoutMs = timeout == 0 ? -1: unit.toMillis(Utils.adjustTimeout(timeout));
                       // Every second check if line is printed and if process is still alive
                       Utils.waitForCondition(() -> latch.getCount() == 0 || !p.isAlive(),
      - unit.toMillis(Utils.adjustTimeout(timeout)), 1000);
      + timeoutMs , 1000);

                       if (latch.getCount() > 0) {
                           if (!p.isAlive()) {

            lmesnik Leonid Mesnik
            lmesnik Leonid Mesnik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: