`Pane.send_keys` types nothing and raises nothing for text that starts with `-`
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend-api-design, cli
Direzione di ricerca
Leggi src/libtmux/pane.py nella sezione relativa alla costruzione di argv di Pane.send_keys alla riga 847 e verifica come Pane.cmd gestisce gli argomenti di tmux. Riproduci il caso con l'input fornito -n hello, poi verifica se raggiunge il pane o se viene generato l'errore di tmux. Il lavoro è completo quando literal=False e literal=True si comportano come previsto con testo che inizia con un trattino.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
- Lingua principale
- Python
- Stelle
- 1.2k
- Fork
- 127
- Merge medio
- 2h 37m
- PR unite (30g)
- 33
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tmux-python/libtmux
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
tmux-python/libtmux#856 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
tmux-python/libtmux#839 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
`show_option` coerces user options, so an `@` option set to `123` or `on` comes back as an int or a boolForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
tmux-python/libtmux#759 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
tmux-python/libtmux#745 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Documentation: how to use internal libtmux loggingForse già presa @tony l’ha presa 84 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
tmux-python/libtmux#744 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di tmux-python/libtmux
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
deepchem/deepchem#5289 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Pull Request for pretty_macAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
UKGovernmentBEIS/inspect_evals#2892 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Versioning docs: say that no output from the 0.46 warning check means nothing is affectedForse già presa @grelinfo l’ha presa oggi. Apertadocumentation priority:low size:S
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
alphacrack/readme2demo#293 ·