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

Runtime::exec clarification of inherited environment

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 20
    • core-libs
    • None
    • behavioral
    • minimal
    • Hide
      The launching of a process using Runtime.exec, ProcessBuilder.start, or ProcessBuilder.startPipeline identifies a minimum set of system dependent environment variables that may be needed to create a new process.
      The change to the behavior of the inherited environment (when the passed environment is null) allows the values of the system dependent environment variables to be modified from those in the parent process environment.
      The changes to the environment variables system dependent and part of the process launch implementation. Though they may be visible to the program, the program does not control their values nor is the behavior of the program usually affected by them.
      Show
      The launching of a process using Runtime.exec, ProcessBuilder.start, or ProcessBuilder.startPipeline identifies a minimum set of system dependent environment variables that may be needed to create a new process. The change to the behavior of the inherited environment (when the passed environment is null) allows the values of the system dependent environment variables to be modified from those in the parent process environment. The changes to the environment variables system dependent and part of the process launch implementation. Though they may be visible to the program, the program does not control their values nor is the behavior of the program usually affected by them.
    • Java API, Use or define an environment variable
    • SE

      Summary

      The launch of a process using Runtime.exec, ProcessBuilder.start, or ProcessBuilder.startPipeline descriptions clarify the system dependent environment inherited by the child. The minimum system dependent environment values of the parent may be overridden with appropriate values in the child.

      Problem

      The current description of Runtime.exec, ProcessBuilder.start, and ProcessBuilder.startPipeline identifies a minimum set of system dependent environment variables needed to launch a process and allows additional system dependent environment variables to be present in the child. However, it does not acknowledge that the parent's values of the minimum set of system dependent variables may not be appropriate for the child.

      Solution

      The description of the minimum set of system dependent environment variables is extended to allow the parent's values of those environment variables to be overridden in the child.

      Specification

      The javadoc of three methods is updated to add a description of the permitted override:

      In java.lang.Runtime.exec(String[] cmdarray, String[] envp, File dir)...:

        * <p>A minimal set of system dependent environment variables may
        * be required to start a process on some operating systems.
        * As a result, the subprocess may inherit additional environment variable
        * settings beyond those in the specified environment.
      + * The minimal set of system dependent environment variables
      + * may override the values provided in the environment.

      In java.lang.ProcessBuilder.start()...:

        * <p>A minimal set of system dependent environment variables may
        * be required to start a process on some operating systems.
        * As a result, the subprocess may inherit additional environment variable
        * settings beyond those in the process builder's {@link #environment()}.
      + * The minimal set of system dependent environment variables
      + * may override the values provided in the environment.

      In java.lang.ProcessBuilder.startPipeline(List<ProcessBuilder> builders)...:

        * A minimal set of system dependent environment variables may
        * be required to start a process on some operating systems.
        * As a result, the subprocess may inherit additional environment variable
        * settings beyond those in the process builder's {@link #environment()}.
      + * The minimal set of system dependent environment variables
      + * may override the values provided in the environment.

            rriggs Roger Riggs
            kganapureddy Krushnareddy Ganapureddy
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: