< prev index next >

src/java.base/windows/classes/java/lang/ProcessImpl.java

Print this page
*** 513,11 ***
              else {
                  FileDescriptor stdin_fd = new FileDescriptor();
                  fdAccess.setHandle(stdin_fd, stdHandles[0]);
                  fdAccess.registerCleanup(stdin_fd);
                  stdin_stream = new BufferedOutputStream(
!                     new FileOutputStream(stdin_fd));
              }
  
              if (stdHandles[1] == -1L || forceNullOutputStream)
                  stdout_stream = ProcessBuilder.NullInputStream.INSTANCE;
              else {
--- 513,11 ---
              else {
                  FileDescriptor stdin_fd = new FileDescriptor();
                  fdAccess.setHandle(stdin_fd, stdHandles[0]);
                  fdAccess.registerCleanup(stdin_fd);
                  stdin_stream = new BufferedOutputStream(
!                     new PipeOutputStream(stdin_fd));
              }
  
              if (stdHandles[1] == -1L || forceNullOutputStream)
                  stdout_stream = ProcessBuilder.NullInputStream.INSTANCE;
              else {

*** 562,15 ***
          return exitCode;
      }
      private static native int getExitCodeProcess(long handle);
  
      public int waitFor() throws InterruptedException {
!         long comp = Blocker.begin();
          try {
              waitForInterruptibly(handle);
          } finally {
!             Blocker.end(comp);
          }
          if (Thread.interrupted())
              throw new InterruptedException();
          return getExitCodeProcess(handle);
      }
--- 562,15 ---
          return exitCode;
      }
      private static native int getExitCodeProcess(long handle);
  
      public int waitFor() throws InterruptedException {
!         boolean attempted = Blocker.begin();
          try {
              waitForInterruptibly(handle);
          } finally {
!             Blocker.end(attempted);
          }
          if (Thread.interrupted())
              throw new InterruptedException();
          return getExitCodeProcess(handle);
      }

*** 591,15 ***
              long msTimeout = TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L);
              if (msTimeout < 0) {
                  // if wraps around then wait a long while
                  msTimeout = Integer.MAX_VALUE;
              }
!             long comp = Blocker.begin();
              try {
                  waitForTimeoutInterruptibly(handle, msTimeout);
              } finally {
!                 Blocker.end(comp);
              }
              if (Thread.interrupted())
                  throw new InterruptedException();
              if (getExitCodeProcess(handle) != STILL_ACTIVE) {
                  return true;
--- 591,15 ---
              long msTimeout = TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L);
              if (msTimeout < 0) {
                  // if wraps around then wait a long while
                  msTimeout = Integer.MAX_VALUE;
              }
!             boolean attempted = Blocker.begin();
              try {
                  waitForTimeoutInterruptibly(handle, msTimeout);
              } finally {
!                 Blocker.end(attempted);
              }
              if (Thread.interrupted())
                  throw new InterruptedException();
              if (getExitCodeProcess(handle) != STILL_ACTIVE) {
                  return true;
< prev index next >