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

ProcessHandle.Info's commandLine() and arguments() return nothing on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 17
    • core-libs
    • None
    • x86
    • windows_10

      This is the test case:
      ===================
      <pre>
      public class TestProc {
          public static void main(String... args) {
              ProcessHandle ph = ProcessHandle.current();
              ProcessHandle.Info info = ph.info();
              System.out.println("Pid = " + ph.pid());
              System.out.println("CommandLine: ");
              if (info.commandLine().isPresent()) {
                  System.out.println(info.commandLine().get());
              }
              System.out.println("Command:");
              if (info.command().isPresent()) {
                  System.out.println(info.command().get());
              }
              System.out.println("Arguments: ");
              if (info.arguments().isPresent()) {
                  for (String s : info.arguments().get()) {
                      System.out.println(s);
                  }
              }
          }
      }

      java -XX:-UseCompressedOops TestProc 1 2 3
      On Linux/MacOS
      Pid = 27758
      CommandLine:
      /jdk2/home/minqi/ws/fixup/try/jdk/build/linux-x86_64-server-release/images/jdk/bin/java -XX:-UseCompressedOops TestProc 1 2 3
      Command:
      /jdk2/home/minqi/ws/fixup/try/jdk/build/linux-x86_64-server-release/images/jdk/bin/java
      Arguments:
      -XX:-UseCompressedOops
      TestProc
      1
      2
      3
      On Windows:
      Pid = 6068
      CommandLine:
      Command:
      C:\Users\opc\yqi\bin\jdk17\bin\java.exe
      Arguments:
      </pre>

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

              Created:
              Updated: