Skip to content

Return a proper exit code if an error occurs#65

Merged
mla merged 1 commit intomla:masterfrom
KevinCarterDev:proper_exit_code
Mar 30, 2025
Merged

Return a proper exit code if an error occurs#65
mla merged 1 commit intomla:masterfrom
KevinCarterDev:proper_exit_code

Conversation

@KevinCarterDev
Copy link
Copy Markdown
Contributor

My perl is super rusty so I'm not sure if this is the best way to do this.

We had an issue recently where pg_sample encountered an error and exited. Unfortunately the END block does exit 0; so our script that runs pg_sample thought that it had finished successfully and continued on. To fix this I've added a $SIG{__DIE__} handler that records the error to @reason. Then in the END block I check if @reason is set and if so exit with code 1 to signify an error occurred.

@mla
Copy link
Copy Markdown
Owner

mla commented Mar 27, 2025

Ty Kevin! Will review this weekend

@mla mla merged commit 46f6e8c into mla:master Mar 30, 2025
@mla
Copy link
Copy Markdown
Owner

mla commented Mar 30, 2025

Merged. I simplified it a bit, I think... let me know if u see any prob with that. thx again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants