libtmux icon indicating copy to clipboard operation
libtmux copied to clipboard

Missing `TmuxObjectDoesNotExist` and silent stderr on closed targets

Open dryslope opened this issue 5 years ago • 0 comments

Summary

In 0.8.x, acting on a manually closed pane or window raised IndexError: list index out of range inside _info. On the Obj dataclass hierarchy (v0.62.0), IndexError is gone, but closed-target failures remain inconsistent across methods:

  • Pane.capture_pane (src/libtmux/pane.py line 670) and Pane.send_keys (src/libtmux/pane.py line 828) do not call raise_if_stderr, silently returning [] or None when tmux reports can't find pane: %N.
  • Obj._refresh (src/libtmux/neo.py line 524) executes assert obj is not None, raising AssertionError (or silently no-opping under python -O) when the target pane, window, or session was closed.
  • Methods that call raise_if_stderr (such as Window.kill and Pane.kill) raise bare LibTmuxException rather than TmuxObjectDoesNotExist when _is_target_not_found_error matches can't find ....

Expected

Operations on a closed pane, window, or session raise TmuxObjectDoesNotExist (a LibTmuxException subclass) rather than silently discarding can't find ... stderr or failing an assert.

References

dryslope avatar Oct 05 '21 09:10 dryslope