agroal / pgagroal

High-performance connection pool for PostgreSQL
https://agroal.github.io/pgagroal/
BSD 3-Clause "New" or "Revised" License
681 stars 61 forks source link

Fix exit status when parsing error occurs in pgagroal-cli #431

Closed decarv closed 6 months ago

decarv commented 6 months ago

While experimenting in https://github.com/agroal/pgagroal/pull/427, I found out that pgagroal-cli returns an exit status of 0, indicating success to the caller, if a command parsing error occurs.

This commit resolves the issue by setting exit_error = 1; after a parsing error, ensuring it properly returns the correct error status to the caller.

Notice that the same does not occur with pgagroal-admin (it has a different way of handling errors -- goto error, while pgagroal-cli goes to the same label --done).

fluca1978 commented 6 months ago

Looks fine to me. @jesperpedersen PTAL

jesperpedersen commented 6 months ago

Rebased, and merged.

Thanks for your contribution !