From 6577443afbcfaa19fce6c60dfb343023738a0774 Mon Sep 17 00:00:00 2001 From: Komlan KEDJI Date: Tue, 24 Sep 2024 10:06:47 +0000 Subject: [PATCH] fix: set ON_ERROR_STOP=1 for psql, so calling scripts get an exit status Currently, using `postgres:connect` with a script passed in through stdin, there is no way to know if the script failed or not. This change aligns the behavior with https://github.com/docker-library/postgres/blob/eaa1c35769621a6bb1e499073a5812ba478c7688/docker-entrypoint.sh#L196 which returns an exit status. --- functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions b/functions index a09b4c8..9442d72 100755 --- a/functions +++ b/functions @@ -18,7 +18,7 @@ service_connect() { local SERVICE_TTY_OPTS has_tty && SERVICE_TTY_OPTS="-t" - "$DOCKER_BIN" container exec --env=LANG=C.UTF-8 --env=LC_ALL=C.UTF-8 -i $SERVICE_TTY_OPTS "$SERVICE_NAME" psql -h localhost -U postgres "$DATABASE_NAME" + "$DOCKER_BIN" container exec --env=LANG=C.UTF-8 --env=LC_ALL=C.UTF-8 -i $SERVICE_TTY_OPTS "$SERVICE_NAME" psql -v ON_ERROR_STOP=1 -h localhost -U postgres "$DATABASE_NAME" } service_create() {