Skip to content

Commit c179f22

Browse files
committed
Window(fix[rename_window]): propagate exception instead of swallowing
why: Previously, rename_window silently swallowed exceptions and returned self, making callers believe the rename succeeded when it failed. what: - Drop try/except, use proc.stderr + raise pattern matching rename_session - Propagate LibTmuxException on tmux errors
1 parent aaabdd7 commit c179f22

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/libtmux/window.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,11 @@ def rename_window(self, new_name: str) -> Window:
481481
lex.escape = " "
482482
lex.whitespace_split = False
483483

484-
try:
485-
self.cmd("rename-window", new_name)
486-
self.window_name = new_name
487-
except Exception:
488-
logger.exception("Error renaming window to %s", new_name)
484+
proc = self.cmd("rename-window", new_name)
485+
if proc.stderr:
486+
raise exc.LibTmuxException(proc.stderr)
489487

488+
self.window_name = new_name
490489
self.refresh()
491490

492491
return self

0 commit comments

Comments
 (0)