`Pane.send_keys` types nothing and raises nothing for text that starts with `-`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend-api-design, cli
Hướng nghiên cứu
Đọc src/libtmux/pane.py ở phần tạo argv của Pane.send_keys tại dòng 847 và kiểm tra cách Pane.cmd xử lý các đối số tmux. Tái hiện bằng đầu vào -n hello được cung cấp, sau đó xác minh đầu vào đó có đến được pane hay lỗi của tmux được phát sinh. Hoàn tất khi cả literal=False và literal=True đều hoạt động như mong đợi với văn bản bắt đầu bằng dấu gạch ngang.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Pane.send_keys("-n hello") returns normally, yet nothing reaches the pane, with literal=False and with literal=True. tmux rejects the call with unknown flag -n and exit status 1. send_keys passes the text right after its own flags with no --, and does not check the result. Text that starts with - is ordinary in scripted input: command-line flags, Markdown bullets, negative numbers.
Reproduction
- Start a private server with a
shpane and send text that starts with-:
import libtmux
srv = libtmux.Server(socket_name="sendkeys-dash", config_file="/dev/null")
pane = srv.new_session("probe", window_command="sh").active_window.active_pane
pane.send_keys("-n hello", enter=False)
pane.send_keys("-n hello", enter=False, literal=True)
print(repr(pane.capture_pane()[-1]))
srv.kill()
- Send the same text through
Pane.cmdwith--:
proc = pane.cmd("send-keys", "-l", "--", "-n hello")
Expected
The pane shows $ -n hello, or send_keys raises with tmux's error.
Actual
The pane shows '$'. Both calls return without raising. The raw call without -- fails with command send-keys: unknown flag -n; with -- it types the text.
Environment
- libtmux:
masterat886b1cd(v0.62.0 plus 114 commits) - tmux: 3.8 (system build reports 3.8a)
- Python: run with
uv run --frozenfrom the libtmux checkout - OS: Linux (WSL2), private
-Lsocket,-f /dev/null
Evidence
send_keys('-n hello', literal=False): no exception
send_keys('-n hello', literal=True): no exception
pane line after sends: '$'
pane.cmd('send-keys', ('-l', '-n hello')): returncode=1 stderr=['command send-keys: unknown flag -n']
pane.cmd('send-keys', ('-l', '--', '-n hello')): returncode=0 stderr=[]
pane line after raw sends: '$ -n hello'
References
- The call that builds the argv:
src/libtmux/pane.py#L847 - The Go and TypeScript ports put
--before the text:tmux/pane_input.go#L248,pane_io.ts#L30 - Projects that guard this by hand: mitsuhiko/agent-stuff tells agents to send
-l --(SKILL.md#L54); ntm notes a trailing;is eaten even after--(session.go#L1969); UltiSnips escapes by trial (vim_interface.py#L161)
- Ngôn ngữ chính
- Python
- Star
- 1.2k
- Fork
- 127
- Merge trung bình
- 2 giờ 37 phút
- Pull request đã merge (30 ngày)
- 33
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tmux-python/libtmux
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
tmux-python/libtmux#856 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
tmux-python/libtmux#839 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`show_option` coerces user options, so an `@` option set to `123` or `on` comes back as an int or a boolCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
tmux-python/libtmux#759 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
tmux-python/libtmux#745 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Documentation: how to use internal libtmux loggingCó thể đã có người làm @tony đã nhận 84 ngày trước. Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tmux-python/libtmux#744 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của tmux-python/libtmux
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
deepchem/deepchem#5289 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Pull Request for pretty_macĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
UKGovernmentBEIS/inspect_evals#2892 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Versioning docs: say that no output from the 0.46 warning check means nothing is affectedCó thể đã có người làm @grelinfo đã nhận hôm nay. Đang mởdocumentation priority:low size:S
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
alphacrack/readme2demo#293 ·