`Pane.send_keys` types nothing and raises nothing for text that starts with `-`
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 82/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- python
- Domínio
- backend-api-design, cli
Direção de pesquisa
Leia src/libtmux/pane.py na parte da construção de argv de Pane.send_keys na linha 847 e verifique como Pane.cmd lida com argumentos do tmux. Reproduza o caso com a entrada fornecida -n hello e depois verifique se ela chega ao pane ou se o erro do tmux é gerado. O trabalho estará concluído quando literal=False e literal=True se comportarem como esperado para textos que começam com um hífen.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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)
- Linguagem predominante
- Python
- Estrelas
- 1.2k
- Forks
- 127
- Merge médio
- 2h 37min
- PRs com merge (30d)
- 33
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de tmux-python/libtmux
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
tmux-python/libtmux#856 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
tmux-python/libtmux#839 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`show_option` coerces user options, so an `@` option set to `123` or `on` comes back as an int or a boolTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
tmux-python/libtmux#759 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
tmux-python/libtmux#745 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Documentation: how to use internal libtmux loggingTalvez já em andamento @tony assumiu há 84 dias. Abertaenhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
tmux-python/libtmux#744 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de tmux-python/libtmux
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
deepchem/deepchem#5289 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
Pull Request for pretty_macAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 60/100
UKGovernmentBEIS/inspect_evals#2892 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Versioning docs: say that no output from the 0.46 warning check means nothing is affectedTalvez já em andamento @grelinfo assumiu hoje. Abertadocumentation priority:low size:S
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
alphacrack/readme2demo#293 ·