From 8d0c2ac4a5ee5b14e78dc53a11d2e0d10c896d57 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 c11da4f..e9d2b6a 100644 --- a/lib/database/open +++ b/lib/database/open @@ -1,11 +1,15 @@ #!/usr/bin/env bash openDatabase() { + local \ + populate_db + [[ -f "$database" ]] || populate_db=1 rm -f "$tempdir"/sqlite.{in,out} mkfifo "$tempdir"/sqlite.{in,out} sqlite3 -bail "$database" \ < "$tempdir/sqlite.in" \ > "$tempdir/sqlite.out" & + db_pid=$! exec 3> "$tempdir"/sqlite.in exec 4< "$tempdir"/sqlite.out rm "$tempdir"/sqlite.in "$tempdir"/sqlite.out