JDK-8133216 : (process) add ProcessHandle.Info.commandLine
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2015-08-07
  • Updated: 2017-05-17
  • Resolved: 2015-09-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Description
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();


Comments
The new API was added by 8131168.
02-09-2015

Created a separate issue to track the API change in parallel with the updates to the ProcessHandle impl.
07-08-2015