`Pane.send_keys` types nothing and raises nothing for text that starts with `-`
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
阅读 src/libtmux/pane.py 中第 847 行附近 Pane.send_keys 构造 argv 的部分,并检查 Pane.cmd 如何处理 tmux 参数。使用提供的 -n hello 输入重现问题,然后确认它是否到达 pane,或者是否引发 tmux 错误。当 literal=False 和 literal=True 对以短横线开头的文本都按预期工作时,即为完成。
由索引模型根据 Issue 内容生成。
描述
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)
- 主要语言
- Python
- 星标
- 1.2k
- 派生
- 127
- 平均合并
- 2 小时 37 分钟
- 30 天内合并 PR
- 33
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tmux-python/libtmux 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
tmux-python/libtmux#856 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
tmux-python/libtmux#839 · 1 条评论 ·
维护者通常 1 天内回复
-
`show_option` coerces user options, so an `@` option set to `123` or `on` comes back as an int or a bool可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
tmux-python/libtmux#759 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
tmux-python/libtmux#745 · 2 条评论 ·
维护者通常 1 天内回复
-
Documentation: how to use internal libtmux logging可能已有人在做 @tony 于 84 天前认领。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 72/100
tmux-python/libtmux#744 ·
维护者通常 1 天内回复
查看 tmux-python/libtmux 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
deepchem/deepchem#5289 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 60/100
UKGovernmentBEIS/inspect_evals#2892 · 1 条评论 ·
维护者通常 1 天内回复
-
Versioning docs: say that no output from the 0.46 warning check means nothing is affected可能已有人在做 @grelinfo 今天认领。 未关闭documentation priority:low size:S
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
alphacrack/readme2demo#293 ·