fix: quote embedded paths in status-right widget
This commit is contained in:
parent
2ef4eb49ce
commit
e174226651
2 changed files with 6 additions and 4 deletions
6
party
6
party
|
|
@ -446,7 +446,6 @@ party_self_path() {
|
|||
esac
|
||||
}
|
||||
|
||||
|
||||
# After spawning the party server, configure status line and hooks.
|
||||
# All commands run against -S "$sock". Every literal name embedded
|
||||
# is shell-quoted to survive tmux's parser.
|
||||
|
|
@ -486,8 +485,11 @@ EOF
|
|||
|
||||
"$PARTY_TMUX" -S "$sock" set-option -s exit-empty on
|
||||
party_self=$(party_self_path)
|
||||
# The #() body is run by the tmux server via sh, so the embedded
|
||||
# paths are single-quoted — a path containing a single quote is
|
||||
# accepted breakage (host's own install path).
|
||||
"$PARTY_TMUX" -S "$sock" set-option -g status-right \
|
||||
"party: #($party_self who --short --socket $sock 2>/dev/null)"
|
||||
"party: #('$party_self' who --short --socket '$sock' 2>/dev/null)"
|
||||
# Join/leave broadcast. Hook bodies fan a display-message out to
|
||||
# every attached client of THIS server via the notify helper script.
|
||||
# tmux substitutes #{client_user} before running the shell command.
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ party_rec() { printf '%s/party-%s:%s.d/roster\n' "$PARTY_SOCKET_DIR" "$USER" "$1
|
|||
rec=$(party_rec srtest)
|
||||
sock=$(awk -F= '$1=="SOCKET"{print $2}' "$rec")
|
||||
sr=$(tmux -S "$sock" show-options -gv status-right)
|
||||
[[ "$sr" == *"party who --short"* ]]
|
||||
[[ "$sr" == *"who --short"* ]]
|
||||
# The #() body is executed with the tmux server's PATH, which need
|
||||
# not contain an installed `party` — the widget must pin the absolute
|
||||
# path of the script that hosted the party.
|
||||
[[ "$sr" == "party: #(/"* ]]
|
||||
[[ "$sr" == "party: #('/"* ]]
|
||||
}
|
||||
|
||||
@test "client-attached hook invokes a notify helper that broadcasts display-message" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue