2021-07-03 19:57:21 +08:00
|
|
|
#RUN: %fish -C 'set -g fish %fish' %s
|
|
|
|
#REQUIRES: command -v tmux
|
|
|
|
|
2021-07-10 03:30:02 +08:00
|
|
|
set fish (builtin realpath $fish)
|
|
|
|
|
2021-07-03 19:57:21 +08:00
|
|
|
# Isolated tmux.
|
2021-07-05 09:10:17 +08:00
|
|
|
# Note $XDG_CONFIG_HOME typically has a leading double-dot,
|
|
|
|
# so our uvars file will leak across runs; therefore
|
|
|
|
# descend more deeply into the tmpdir.
|
|
|
|
set -g tmpdir (mktemp -d)/inner1/inner2/
|
|
|
|
mkdir -p $tmpdir
|
|
|
|
|
2021-07-10 03:30:02 +08:00
|
|
|
# Don't CD elsewhere, because tmux socket file is relative to CWD. Using
|
|
|
|
# absolute path to socket file is prone to 'socket file name too long' error.
|
|
|
|
cd $tmpdir
|
|
|
|
|
|
|
|
set -g tmux tmux -S .tmux-socket -f /dev/null
|
2021-07-03 19:57:21 +08:00
|
|
|
|
|
|
|
set -g sleep sleep .1
|
2021-07-14 14:43:24 +08:00
|
|
|
set -q CI && set sleep sleep 10
|
2021-07-03 19:57:21 +08:00
|
|
|
|
|
|
|
while set -e prompt_var
|
|
|
|
end
|
|
|
|
|
|
|
|
$tmux new-session -x 80 -y 10 -d $fish -C '
|
|
|
|
# This is similar to "tests/interactive.config".
|
|
|
|
function fish_greeting; end
|
|
|
|
function fish_prompt; printf "prompt $status_generation> <$prompt_var> "; end
|
|
|
|
# No autosuggestion from older history.
|
|
|
|
set fish_history ""
|
|
|
|
function on_prompt_var --on-variable prompt_var
|
|
|
|
commandline -f repaint
|
|
|
|
end
|
|
|
|
'
|
2021-08-11 10:28:01 +08:00
|
|
|
# Set the correct permissions for the newly created socket to allow future connections.
|
|
|
|
# This is required at least under WSL or else each invocation will return a permissions error.
|
|
|
|
chmod 777 .tmux-socket
|
2021-07-03 19:57:21 +08:00
|
|
|
$sleep # Let fish draw a prompt.
|
|
|
|
|
|
|
|
$tmux capture-pane -p
|
|
|
|
# CHECK: prompt 0> <>
|
|
|
|
|
|
|
|
set -U prompt_var changed
|
|
|
|
$sleep
|
|
|
|
$tmux capture-pane -p
|
|
|
|
# CHECK: prompt 0> <changed>
|
|
|
|
|
|
|
|
$tmux kill-server
|
|
|
|
rm -r $tmpdir
|