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

Process/ProcessHandle.onExit() spec need to be improved

XMLWordPrintable

    • b93

      Currently the spec for onExit() of Process and ProcessHandle states:
      "If the process is not alive the CompletableFuture returned has been completed."

      This assertion need to be relaxed, because after the process has been terminated some time is needed for completing of CompletableFuture.

      For example, the following code may print false:
      Process process = ...;
      ProcessHandle ph = process.toHandle();
      process.waitFor();
      // on this step the process is already terminated and isAlive() should return false
      CompletableFuture<ProcessHandle> completableFuture = ph.onExit();
      System.out.println(completableFuture.isDone());

            rriggs Roger Riggs
            evotchen Elena Votchennikova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: