Catch error for commands with output capture = false #175
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.
This is a proposed fix for inconsistency in handling exit status of command with
include-command-output-in-response
set totrue
andfalse
.Currently, if
include-command-output-in-response: true
and command exits with error code != 0,webhook
will return error code500
. However, when set tofalse
,webhook
ignores errors and always returns code200
.Moreover, there are two different paths in the code for each case, which seems as additional inconsistency.
This PR ensures command is spawned in a consistent manner and returns code
500
if command fails in both output capturing and non-capturing modes. There is no need to spawn a separate goroutine, because handler is spawned as a goroutine when the request comes in. This PR executes command in the same goroutine as the handler.It also fixes issues we have discussed in PR #167:
Let me know if this solution works.