Remove dead code related to exit code names #223
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have added some logic to improve error messages, based on the child process termination.
Some of this logic is unreachable, so this is dead code and can be removed.
exitCodeName
cannot beundefined
whenexitCode
is defined. This is because (when missing)exitCodeName
is retrieved usingutil.getSystemErrorName(exitCode)
, and that function always returns a value. When the exit code wrong is wrong (e.g.255
), it will returnUnknown system error -255
.exitCode
cannot beundefined
whenexitCodeName
is defined. This is because (when missing)exitCode
is retrieve usingos.constants.errno[error.code]
.error.code
is fromchild_process.on('error')
.error.code
is guaranteed to be a valid exit code, because it's set within Node.js not by users. I checked the Node.js source and it looks pretty solid. Exception: if user manually triggerschild_process.emit('error')
with an invaliderror.code
, but this seems like an edge case.Both
signal
,exitCode
andexitCodeName
areundefined
. This just cannot happen if you check our current logic.This also improves test coverage.