Skip to content

Fix exit code for commands terminated by signals#2971

Merged
asottile merged 1 commit intopre-commit:mainfrom
chriskuehl:fix-signal-death
Aug 22, 2023
Merged

Fix exit code for commands terminated by signals#2971
asottile merged 1 commit intopre-commit:mainfrom
chriskuehl:fix-signal-death

Conversation

@chriskuehl
Copy link
Copy Markdown
Member

Fixes #2970

Comment on lines -173 to +174
retcode = max(retcode, proc_retcode)
if abs(proc_retcode) > abs(retcode):
retcode = proc_retcode
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used this over something like retcode = retcode or proc_retcode just so that it would consistently pick the same exit status from a set of exit statuses. If you prefer some other way of selecting which to use, I can change it to that.

Copy link
Copy Markdown
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile asottile merged commit 0c3d605 into pre-commit:main Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

pre-commit treats hook commands dying due to POSIX signal as successful

2 participants