8226242 : Diagnostic output for posix_spawn failure
David Holmes
david.holmes at oracle.com
Mon Jun 17 22:16:52 UTC 2019
Hi Roger,
On 18/06/2019 6:00 am, Roger Riggs wrote:
> Hi,
>
> Updated:
> http://cr.openjdk.java.net/~rriggs/webrev-spawn-diag-8225192-3/
+ if (WIFEXITED(status)) {
+ snprintf(ebuf, sizeof ebuf,
+ "Failed to exec spawn helper: pid: %d, exit value: %d",
+ pid, WEXITSTATUS(status));
WIFEXITED returns non-zero when the process terminates normally, so that
need not be an error AFAICS.
David
>
> On 6/17/19 2:20 PM, Martin Buchholz wrote:
>>
>>
>> On Mon, Jun 17, 2019 at 10:47 AM Thomas Stüfe <thomas.stuefe at gmail.com
>> <mailto:thomas.stuefe at gmail.com>> wrote:
>>
>> Hi Roger,
>>
>> I think this is fine.
>>
>> Could you please also print out WIFEXITED and WIFSIGNALLED? Since
>> I am not
>> sure if the WEXITSTATUS contains valid info if WIFEXITED is 0, or
>> just
>> random noise. Same for WTERMSIG.
>>
> I separated the causes, both exits are abnormal since the exec didn't'
> do what was expected.
> Only an exit status of 0 is 'normal' and in this case, that is not what
> expected.
>
> Regards, Roger
>>
>>
>> Alternatively:
>> if (WIFEXITED) print("exited normaly with %d", WEXITSTATUS)
>> else if (WIFSTOPPED) print("terminated with signal %d", WTERMSIG)
>>
>>
>> thanks for doing this.
>>
>> I also think it's best to have different detail messages for normal
>> termination and death by signal, as some shells do.
>>
>> I might put the exception throwing code into a separate function.
>
More information about the core-libs-dev
mailing list