From b0714511e8557686cda9e0551324fd273a97e9b1 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Fri, 25 Sep 2026 13:49:05 +0300 Subject: profile: stop shadowing exit `exit` was a function that ran `tmux detach` instead of exiting, whenever a shell was interactive and inside tmux. What it bought was a keystroke: tmux already binds detach to prefix-d, which this config does not touch. What it cost was an afternoon. Claude Code captures shell functions into a snapshot and sources it in every tool call, so agent shells inheriting $TMUX ran the function too: terminal windows closed on their own for weeks before anyone connected it to `exit`, and a poll loop that called `exit 0` detached a client every minute instead of stopping, because the function detached and then returned. The call-time guard added on 2026-07-16 fixed that case; it did not make shadowing a POSIX builtin a good idea. Nothing in either repo calls it and nothing documents the behaviour. --- config/profile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/config/profile b/config/profile index 8f63f9e..e3843ed 100755 --- a/config/profile +++ b/config/profile @@ -109,17 +109,6 @@ HISTSIZE=1000000 # shellcheck disable=SC2034 SAVEHIST=1000000 -# detach from tmux by default -# Guard at call time, not definition time. -# functions and sources them in non-interactive tool shells that inherit -# $TMUX, where a bare `exit` must really exit (not detach the terminal). -exit() { - if [[ -n "${TMUX:-}" ]] && [[ $- == *i* ]]; then - tmux detach - else - builtin exit "$@" - fi -} exists() { command -v "$1" >/dev/null 2>&1; } # Check if command exists (is in path). lspath() { echo "$PATH" | tr ':' '\n'; } # list PATH entries pathadd() { [[ -d "$1" ]] && PATH="$1"$(echo ":$PATH:" | sed "s|:$1:|:|" | sed 's|:$||'); } -- cgit v1.2.3