Troubleshooting step hanging after running psql command

Problem:

When running a command like psql, the step can hang and lead to it timing out. This is due to it expecting the user to interact with it whereas CircleCI jobs are run in a non-interactive environment.

Solutions:

  • Disable psql pager with -P 'pager=off' option

    • Example:
      psql -q -d postgres -h localhost -p ${TEST_DB_PORT:-'5433'} -P 'pager=off' -U test -w -c "DROP DATABASE IF EXISTS test;";

Outcome:

The step will no longer hang, and will finish executing, preventing a long running job.

Additional Resources:

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.