ADDITIONAL SYSTEM INFORMATION :
Linux 6.8
A DESCRIPTION OF THE PROBLEM :
When the starting command line is over 4096 characters, commandLine() response is truncated to 4096 characters and arguments() returns empty result. Since Linux 4.2 /proc/<pid>/cmdline is not truncated anymore, so it should be possible to fetch the full command line on any modern system.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use the following code and start the program with any long enough arguments:
ProcessHandle.Info info = ProcessHandle.current().info();
System.err.println(info.commandLine());
System.err.println(info.commandLine().orElseThrow().length());
System.err.println(info.arguments().map(Arrays::toString));
FREQUENCY : always
Linux 6.8
A DESCRIPTION OF THE PROBLEM :
When the starting command line is over 4096 characters, commandLine() response is truncated to 4096 characters and arguments() returns empty result. Since Linux 4.2 /proc/<pid>/cmdline is not truncated anymore, so it should be possible to fetch the full command line on any modern system.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use the following code and start the program with any long enough arguments:
ProcessHandle.Info info = ProcessHandle.current().info();
System.err.println(info.commandLine());
System.err.println(info.commandLine().orElseThrow().length());
System.err.println(info.arguments().map(Arrays::toString));
FREQUENCY : always