Skip to content

Commit 4e84ef0

Browse files
committed
Pane(fix[display_popup]): raise ValueError when close_on_exit + close_on_success combined
why: tmux counts -E flags via args_count(); 3x -E evaluates as != 2, falls through to the args_has() branch and silently behaves like 1x -E (close-on-any-exit), discarding the close_on_success intent entirely. what: - Add mutual-exclusion guard: raise ValueError when both close_on_exit and close_on_success are True - Assign message to variable first to satisfy EM101/TRY003 linting rules
1 parent 51e74f2 commit 4e84ef0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libtmux/pane.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,14 @@ def display_popup(
12561256
if close_existing:
12571257
tmux_args += ("-C",)
12581258

1259+
if close_on_exit and close_on_success:
1260+
msg = (
1261+
"close_on_exit and close_on_success are mutually exclusive: "
1262+
"use close_on_exit=True for -E (close on any exit) "
1263+
"or close_on_success=True for -EE (close on zero exit code only)"
1264+
)
1265+
raise ValueError(msg)
1266+
12591267
if close_on_exit:
12601268
tmux_args += ("-E",)
12611269

0 commit comments

Comments
 (0)