From 03bbd70947504dd8020120b1017853cbe152bff7 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Sat, 14 Feb 2026 05:37:58 +0100 Subject: [PATCH] quickfix: don't hang waiting on bg jobs with SQL debug --- lib/database/close | 3 ++- lib/database/open | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/database/close b/lib/database/close index 9fb38ca..fbb829e 100644 --- a/lib/database/close +++ b/lib/database/close @@ -3,7 +3,8 @@ closeDatabase() { echo 'vacuum;' >&3 echo .quit >&3 (( debug )) && echo -n "Waiting for SQLite to terminate... " - wait + (( debug > 2 )) && exec 5>&- + wait $db_pid (( debug )) && echo OK exec 3>&- exec 4<&- diff --git a/lib/database/open b/lib/database/open index b287314..c63d148 100644 --- a/lib/database/open +++ b/lib/database/open @@ -1,5 +1,8 @@ #!/usr/bin/env bash openDatabase() { + local \ + populate_db + [[ -f "$database" ]] || populate_db=1 rm -f "$tempdir"/sqlite.{in,out} mkfifo "$tempdir"/sqlite.{in,out} @@ -10,6 +13,7 @@ openDatabase() { | stdbuf -o0 \ sed 's/::AtOM:SQL:EOL::/\x0/g;s/\(\x0\)\xA/\1/g' \ > "$tempdir/sqlite.out" & + db_pid=$! exec 3> "$tempdir"/sqlite.in exec 4< "$tempdir"/sqlite.out rm "$tempdir"/sqlite.{in,out}