feat(c5): prune old tmux logs and share pipe-pane helper
Extract the tmux pipe-pane setup into functions/_tmux_pipe_log.fish, called by both conf.d/tmux-logging.fish (startup) and __fish_config_sync_logging (C5 re-enable). The helper prunes the oldest tmux_*.log files by mtime to stay within SCROLLBACK_HISTORY_MAX_FILES, matching the paru/yay wrappers. Uses 'command ls' to bypass the eza ls shadow, which injects OSC-8 hyperlink escapes into paths and corrupted the filenames passed to rm.
This commit is contained in:
@@ -34,14 +34,7 @@ function __fish_config_sync_logging --description 'Sync C5 logging state: sentin
|
||||
rm -f $sentinel
|
||||
|
||||
# Restart tmux pipe-pane for the current pane if inside tmux
|
||||
if set -q TMUX
|
||||
set -l log_dir (set -q SCROLLBACK_HISTORY_DIR; and echo $SCROLLBACK_HISTORY_DIR; or echo "$HOME/.terminal_history")
|
||||
set -l pane_id (tmux display-message -p '#{session_name}-w#{window_index}-p#{pane_index}' 2>/dev/null)
|
||||
set -l timestamp (date "+%Y-%m-%d_%H-%M-%S")
|
||||
set -l log_file "$log_dir/tmux_"$pane_id"_"$timestamp".log"
|
||||
mkdir -p $log_dir
|
||||
tmux pipe-pane "cat >> $log_file" 2>/dev/null
|
||||
end
|
||||
_tmux_pipe_log
|
||||
|
||||
if test -x /usr/bin/paru
|
||||
mkdir -p (dirname $paru_wrapper)
|
||||
|
||||
Reference in New Issue
Block a user