< prev index next >

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

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this
--- 1,7 ---
  /*
!  * Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

*** 494,28 ***
--- 494,31 ---
              if (stdHandles[0] == -1L)
                  stdin_stream = ProcessBuilder.NullOutputStream.INSTANCE;
              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 {
                  FileDescriptor stdout_fd = new FileDescriptor();
                  fdAccess.setHandle(stdout_fd, stdHandles[1]);
+                 fdAccess.registerCleanup(stdout_fd);
                  stdout_stream = new BufferedInputStream(
                      new PipeInputStream(stdout_fd));
              }
  
              if (stdHandles[2] == -1L)
                  stderr_stream = ProcessBuilder.NullInputStream.INSTANCE;
              else {
                  FileDescriptor stderr_fd = new FileDescriptor();
                  fdAccess.setHandle(stderr_fd, stdHandles[2]);
+                 fdAccess.registerCleanup(stderr_fd);
                  stderr_stream = new PipeInputStream(stderr_fd);
              }
  
              return null; }});
      }
< prev index next >