From 0a7a52a59fbc3244392ef5d19ef7c4d6f0b8838b Mon Sep 17 00:00:00 2001 From: Tom Hinton Date: Wed, 29 May 2019 09:10:15 +0100 Subject: [PATCH] Fix #45, per PR #46 --- README.org | 2 ++ sqlite-history.zsh | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.org b/README.org index 73b1866..91b4094 100644 --- a/README.org +++ b/README.org @@ -3,6 +3,8 @@ * News - 29/05/19 :: Thanks to Matthias Bilger (https://github.com/m42e/) a bug has been removed which would have broken the database if the vacuum command were used. Turns out, you can't use rowid as a foreign key unless you've given it a name. As a side-effect your database will need updating, in a non-backwards compatible way, so you'll need to update on all your installations at once if you share a history file. Also, it's not impossible that this change will make a problem for someone somewhere, so be careful with this update. + + Also thanks to Matthias, the exit status of long-running commands is handled better. - 05/04/18 :: I've done a bit of work to make a replacement reverse-isearch function, which is in a usable state now. If you want to use it, see the [[Reverse isearch]] section below which now covers it. diff --git a/sqlite-history.zsh b/sqlite-history.zsh index 8db5145..033199c 100644 --- a/sqlite-history.zsh +++ b/sqlite-history.zsh @@ -9,7 +9,6 @@ fi typeset -g HISTDB_SESSION="" typeset -g HISTDB_HOST="" typeset -g HISTDB_INSTALLED_IN="${(%):-%N}" -typeset -g HISTDB_AWAITING_EXIT=0 sql_escape () { sed -e "s/'/''/g" <<< "$@" | tr -d '\000' @@ -59,12 +58,16 @@ fi histdb-update-outcome () { local retval=$? local finished=$(date +%s) - if [[ $HISTDB_AWAITING_EXIT == 1 ]]; then - _histdb_init - _histdb_query "update history set exit_status = ${retval}, duration = ${finished} - start_time -where id = (select max(id) from history) and session = ${HISTDB_SESSION}" - HISTDB_AWAITING_EXIT=0 - fi + + _histdb_init + _histdb_query <