aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoichi Murase <myoga.murase@gmail.com>2024-01-09 05:22:42 +0900
committerGitHub <noreply@github.com>2024-01-08 20:22:42 +0000
commitcc5efd297133148437f6bc8c937743879f952f33 (patch)
tree9fe8abd538ddffbb9e145b21683844266676c7f5
parentfeat: make it clear what you are registering for (#1523) (diff)
downloadatuin-cc5efd297133148437f6bc8c937743879f952f33.zip
fix(shell): fix incorrect timing of child shells (#1510)
When a child shell session is started from another shell session (parent session), the environment variable ATUIN_HISTORY_ID set by the parent session causes Atuin's precmd hook of the child session to be unexpectedly performed before the first call of Atuin's preexec hook. In this patch, we clear ATUIN_HISTORY_ID (possibly set by the parent session) on the startup of the session.
-rw-r--r--atuin/src/shell/atuin.bash1
-rw-r--r--atuin/src/shell/atuin.fish1
-rw-r--r--atuin/src/shell/atuin.nu1
-rw-r--r--atuin/src/shell/atuin.zsh1
4 files changed, 4 insertions, 0 deletions
diff --git a/atuin/src/shell/atuin.bash b/atuin/src/shell/atuin.bash
index ae17ff29..a1ef38b5 100644
--- a/atuin/src/shell/atuin.bash
+++ b/atuin/src/shell/atuin.bash
@@ -1,6 +1,7 @@
ATUIN_SESSION=$(atuin uuid)
ATUIN_STTY=$(stty -g)
export ATUIN_SESSION
+ATUIN_HISTORY_ID=""
__atuin_preexec() {
if [[ ! ${BLE_ATTACHED-} ]]; then
diff --git a/atuin/src/shell/atuin.fish b/atuin/src/shell/atuin.fish
index eeb7d92b..b9847d0e 100644
--- a/atuin/src/shell/atuin.fish
+++ b/atuin/src/shell/atuin.fish
@@ -1,4 +1,5 @@
set -gx ATUIN_SESSION (atuin uuid)
+set --erase ATUIN_HISTORY_ID
function _atuin_preexec --on-event fish_preexec
if not test -n "$fish_private_mode"
diff --git a/atuin/src/shell/atuin.nu b/atuin/src/shell/atuin.nu
index 1231eea0..75e4b8a4 100644
--- a/atuin/src/shell/atuin.nu
+++ b/atuin/src/shell/atuin.nu
@@ -1,5 +1,6 @@
# Source this in your ~/.config/nushell/config.nu
$env.ATUIN_SESSION = (atuin uuid)
+hide-env -i ATUIN_HISTORY_ID
# Magic token to make sure we don't record commands run by keybindings
let ATUIN_KEYBINDING_TOKEN = $"# (random uuid)"
diff --git a/atuin/src/shell/atuin.zsh b/atuin/src/shell/atuin.zsh
index d5277f4b..cd076ab9 100644
--- a/atuin/src/shell/atuin.zsh
+++ b/atuin/src/shell/atuin.zsh
@@ -25,6 +25,7 @@ else
fi
export ATUIN_SESSION=$(atuin uuid)
+ATUIN_HISTORY_ID=""
_atuin_preexec() {
local id