microsoft/azure-pipelines-task-lib

Misleading debug logging when process exits due to receiving a signal

giannisioannou-tomtom opened this issue · 4 comments

Issue Description

toolRunner does not cope with child process exiting due to receiving a signal and thus tasks using it log out unhelpful error messages like: Error: The process '/mnt/azp/_work/_tool/kubectl/1.22.6/x64/kubectl' failed with exit code null. this is due to the fact that the signal that the process was exited with in the exec function of node/toolrunner.ts at cp.on('exit', (code: number, signal: any) is not handed and logged .

According to the documentation of Node:
The 'exit' event is emitted after the child process ends. If the process exited, code is the final exit code of the process, otherwise null. If the process terminated due to receipt of a signal, signal is the string name of the signal, otherwise null. One of the two will always be non-null.

Expected behaviour

When debug logging is enabled and a process exits due to a signal there is an appropriate error message, e.g.:

The process '%s' failed due to receipt of signal %s

Actual behaviour

When debug logging is enabled and a process exits due to a signal the error message is misleading.

Hi @giannisioannou-tomtom!
Thanks for your request, we've added this feature request to our backlog. We'll take a look at it once we have enough capacity.

Hi @giannisioannou-tomtom! Thanks for your request, we've added this feature request to our backlog. We'll take a look at it once we have enough capacity.

Thanks for looking into this. I've sort of got a branch with the proposed change. Could I get write access to create a PR?

Thanks for looking into this. I've sort of got a branch with the proposed change. Could I get write access to create a PR?

We appreciate your contribution, you can just create PR from the forked repo, we will review & merge it.

This issue has had no activity in 90 days. Please comment if it is not actually stale