mirror of
https://github.com/tmux/tmux.git
synced 2026-08-03 05:58:59 +00:00
Do not bind global hooks to a session.
This commit is contained in:
@@ -138,6 +138,7 @@ cmd_set_hook_monitor_exec(struct cmdq_item *item, struct args *args, int window)
|
||||
struct cmd_find_state *target = cmdq_get_target(item), fs;
|
||||
struct options *oo;
|
||||
struct options_entry *o;
|
||||
struct session *s = NULL;
|
||||
char *cause = NULL, *name = NULL, *format = NULL;
|
||||
char *expanded = NULL, *newvalue = NULL;
|
||||
const char *value, *old;
|
||||
@@ -199,7 +200,11 @@ cmd_set_hook_monitor_exec(struct cmdq_item *item, struct args *args, int window)
|
||||
}
|
||||
}
|
||||
|
||||
hooks_monitor_add(item, oo, name, type, id, format, &fs, target->s);
|
||||
if (oo != global_options &&
|
||||
oo != global_s_options &&
|
||||
oo != global_w_options)
|
||||
s = target->s;
|
||||
hooks_monitor_add(item, oo, name, type, id, format, &fs, s);
|
||||
|
||||
out:
|
||||
free(newvalue);
|
||||
|
||||
@@ -147,4 +147,14 @@ $TMUX set -pt "$target_pane" @target-value changed ||
|
||||
fail "set pane @target-value failed"
|
||||
wait_for @target-pane "$target_pane"
|
||||
|
||||
$TMUX new -d -s zzz-survivor || fail "new survivor session failed"
|
||||
$TMUX set -g @global-after-destroy 0 ||
|
||||
fail "set @global-after-destroy failed"
|
||||
$TMUX set-hook -g -t three -B '@global-after-destroy-session::#{session_name}' \
|
||||
'set -g @global-after-destroy "#{hook_last}->#{hook_value}"' ||
|
||||
fail "set-hook -B global after destroy failed"
|
||||
assert_unchanged @global-after-destroy 0
|
||||
$TMUX kill-session -t three || fail "kill destroyed monitor session failed"
|
||||
wait_for @global-after-destroy 'three->zzz-survivor'
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user