fix(db-tool): prevent fd leak from logger to long-running daemons
The hectic logger opens fd 3 as a dup of stderr. Child processes inherit this fd, and daemonized PostgreSQL/PostgREST keeping it open prevents the terminal from returning to the prompt after the spawning script exits. - Add with_closed_fds helper that runs commands in a subshell with fds 3-9 redirected to /dev/null - Inline the helper into both database and postgres-init builds - Wrap pg_ctl start and postgrest with the helper
This commit is contained in:
@@ -148,7 +148,7 @@ log() {
|
||||
''
|
||||
|
||||
# shellcheck disable=SC1003
|
||||
fmt="$(printf "%s$delimetr" "$@" | sed 's/\\033\[0m/''\'"$color"'/g')"
|
||||
fmt="$(printf "%s$delimetr" "$@" | sed 's/\\033\[0m/'\'"$color"'/g')"
|
||||
shift
|
||||
# shellcheck disable=SC1003
|
||||
printf "${BBLACK}${HECTIC_NAMESPACE}> %b\n" "$color$fmt$NC" >&3
|
||||
|
||||
Reference in New Issue
Block a user