quickfix: don't hang waiting on bg jobs with SQL debug
This commit is contained in:
parent
c94b6b40c3
commit
8d0c2ac4a5
@ -3,7 +3,8 @@ closeDatabase() {
|
|||||||
echo 'vacuum;' >&3
|
echo 'vacuum;' >&3
|
||||||
echo .quit >&3
|
echo .quit >&3
|
||||||
(( debug )) && echo -n "Waiting for SQLite to terminate... "
|
(( debug )) && echo -n "Waiting for SQLite to terminate... "
|
||||||
wait
|
(( debug > 2 )) && exec 5>&-
|
||||||
|
wait $db_pid
|
||||||
(( debug )) && echo OK
|
(( debug )) && echo OK
|
||||||
exec 3>&-
|
exec 3>&-
|
||||||
exec 4<&-
|
exec 4<&-
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
openDatabase() {
|
openDatabase() {
|
||||||
|
local \
|
||||||
|
populate_db
|
||||||
|
|
||||||
[[ -f "$database" ]] || populate_db=1
|
[[ -f "$database" ]] || populate_db=1
|
||||||
rm -f "$tempdir"/sqlite.{in,out}
|
rm -f "$tempdir"/sqlite.{in,out}
|
||||||
mkfifo "$tempdir"/sqlite.{in,out}
|
mkfifo "$tempdir"/sqlite.{in,out}
|
||||||
sqlite3 -bail "$database" \
|
sqlite3 -bail "$database" \
|
||||||
< "$tempdir/sqlite.in" \
|
< "$tempdir/sqlite.in" \
|
||||||
> "$tempdir/sqlite.out" &
|
> "$tempdir/sqlite.out" &
|
||||||
|
db_pid=$!
|
||||||
exec 3> "$tempdir"/sqlite.in
|
exec 3> "$tempdir"/sqlite.in
|
||||||
exec 4< "$tempdir"/sqlite.out
|
exec 4< "$tempdir"/sqlite.out
|
||||||
rm "$tempdir"/sqlite.in "$tempdir"/sqlite.out
|
rm "$tempdir"/sqlite.in "$tempdir"/sqlite.out
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user