UNIXProcess.toString -- include more useful information

Roger Riggs Roger.Riggs at Oracle.com
Tue Apr 26 14:43:38 UTC 2016


Created https://bugs.openjdk.java.net/browse/JDK-8155102 to track the 
request.


On 4/26/2016 10:30 AM, Roger Riggs wrote:
> Hi,
>
> The pid (though os specific) is available from the Process API and so 
> adding it to toString
> does not expose any additional implementation specific information.
>
> Getting accurate values for exitcode and running status would require 
> a native call
> on windows but might be ok only for debugging.
>
> $.02, Roger
>
>
> On 4/25/2016 3:49 PM, Martin Buchholz wrote:
>> This is a reasonable request.
>>
>> But if you put platform-specific information into the String, then
>> people will start treating that as an API (parsing the string), which
>> is undesirable.
>>
>> On Mon, Apr 25, 2016 at 12:33 PM, Steven Schlansker
>> <stevenschlansker at gmail.com> wrote:
>>> Hi core-libs-dev,
>>>
>>> I recently was diagnosing a problem relating to an external program 
>>> invoked via
>>> the ProcessBuilder API.
>>>
>>> The returned Process is an instance of java.lang.UNIXProcess, which 
>>> does
>>> not have a toString method.
>>>
>>> While I understand that the concepts of "pid" etc are not 
>>> cross-platform,
>>> it might be useful to operators to have the toString method
>>> dump them as diagnostic information.
>>>
>>> Imagine if instead of
>>>
>>> "java.lang.UNIXProcess@<hashCode>"
>>>
>>> you could see
>>>
>>> "UNIXProcess[running=true, pid=1234]"
>>> "UNIXProcess[running=false, exitCode=127]"
>>>
>>> This seems like it would be a fairly trivial change that could help 
>>> some
>>> operator down the road.
>>>
>>> Is this a reasonable request?  Thanks,
>>> Steven
>>>
>




More information about the core-libs-dev mailing list