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

(process) add ProcessHandle.Info.commandLine

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • 9
    • 9
    • core-libs

      The java.lang.ProcessHandle.Info interface contains methods for the command and arguments.
      Some operating system can only provide a limited command line string.
      The string may not contain the path of the command and may be truncated.

      The Info.commandLine() method is proposed as:
              /**
               * Returns the command line of the process.
               * <p>
               * If {@link #command command()} and {@link #arguments arguments()} return non-null
               * optionals, this is simply a convenience method which concatenates
               * the values of the two functions separated by spaces. Otherwise it will return a
               * best-effort, platform dependent representation of the command line.
               *
               * @apiNote Note that the returned executable pathname and the
               * arguments may be truncated on some platforms due to system
               * limitations.
               * <p>
               * The executable pathname may contain only the
               * name of the executable without the full path information.
               * It is undecidebale whether white space separates different
               * arguments or is part of a single argument.
               *
               * @return an {@code Optional<String>} of the command line
               * of the process
               */
              public Optional<String> commandLine();

            rriggs Roger Riggs
            rriggs Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: