Skip to content

Commit

Permalink
devops: Fix psql tty allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jhf committed Nov 29, 2024
1 parent e865cb7 commit 1c5d2a5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions devops/manage-statbus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -576,13 +576,12 @@ EOS
if $(which psql > /dev/null); then
psql "$@"
else
# Only add -t and -i if we're in an interactive shell with no redirections
if test -t 0 && test -t 1 && test ! -p /dev/stdin && test ! -f /dev/stdin; then
# Enable the TTY in docker with -t for interactive psql prompt
docker compose exec -ti -e PGPASSWORD db psql -U $PGUSER $PGDATABASE "$@"
else
# Non-interactive mode - no -t or -i flags
# Interactive mode - use default TTY allocation
docker compose exec -e PGPASSWORD db psql -U $PGUSER $PGDATABASE "$@"
else
# Non-interactive mode - explicitly disable TTY allocation
docker compose exec -T -e PGPASSWORD db psql -U $PGUSER $PGDATABASE "$@"
fi
fi
;;
Expand Down

0 comments on commit 1c5d2a5

Please sign in to comment.