Specific exceptions raising if pane or window manually closed

Đang mở
#340 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api, cli

Hướng nghiên cứu

The traceback points to libtmux/pane.py (_info and send_keys) and libtmux/window.py (_info and kill_window); start there and reproduce each operation after its pane or window is manually closed. Done means these cases raise specific exceptions instead of IndexError.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Specific exceptions should be raised in some cases.

For example, if we send keys to a previously attached pane of a window, but the window is manually closed while the program is running, this hapens:

Traceback (most recent call last)
[...]
 File "/usr/share//class_tmuxserver.py", line 78, in create_or_clear_window
    self.dict_panes[window_name]["pane_cmd"].send_keys('C-c', enter=False, suppress_history=False)

  File "/usr/share//venv/lib/python3.8/site-packages/libtmux/pane.py", line 117, in send_keys
    self.cmd('send-keys', prefix + cmd)
  File "/usr/share//venv/lib/python3.8/site-packages/libtmux/pane.py", line 90, in cmd
    args = ('-t', self.get('pane_id')) + args
  File "/usr/local/lib/python3.8/_collections_abc.py", line 660, in get
    return self[key]
  File "/usr/share//venv/lib/python3.8/site-packages/libtmux/common.py", line 251, in __getitem__
    return self._info[key]
  File "/usr/share//venv/lib/python3.8/site-packages/libtmux/pane.py", line 75, in _info
    return list(filter(by, self.server._panes))[0]
`IndexError: list index out of range`

Same thing if we try to kill a window which was manually closed in the tmux:

Traceback (most recent call last)
 [...]
  File "/home/admin//src/class_tmuxserver.py", line 116, in kill_tmux_window
    self.dict_windows[window_name].kill_window()
  File "/home/admin//venv/lib64/python3.7/site-packages/libtmux/window.py", line 308, in kill_window
    '-t%s:%s' % (self.get('session_id'), self.index),
  File "/usr/lib64/python3.7/_collections_abc.py", line 660, in get
    return self[key]
  File "/home/admin//venv/lib64/python3.7/site-packages/libtmux/common.py", line 252, in __getitem__
    return self._info[key]
  File "/home/admin//venv/lib64/python3.7/site-packages/libtmux/window.py", line 89, in _info
    return ret[0]
IndexError: list index out of range
Ngôn ngữ chính
Python
Star
1.2k
Fork
127
Merge trung bình
2 giờ 13 phút
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của tmux-python/libtmux

Tất cả issue của tmux-python/libtmux

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.