大网数据广告活动
服务器运维问答

Why is the Windows 11 terminal pushing escape sequences to Tmux?

· 52CE 我爱测

Ssh's RemoteCommand facility can be used to automatically create/attach a tmux session, like this . In Windows, my sessions intermittently see the escape sequence ^ 0;10;1c or ^ [[>1;1c , showing like this in my terminal: This be…

问题原文

原帖链接 · Autumn · CC BY-SA 4.0

Ssh's RemoteCommand facility can be used to automatically create/attach a tmux session, like this. In Windows, my sessions intermittently see the escape sequence ^0;10;1c or ^[[>1;1c, showing like this in my terminal:

This behaviour seems restricted to Windows 11, with both the Terminal and Console Host applications. It does not seem to occur on Windows 10 on any variant of cmd.exe. I'm presently working around it by running with the W11 Console Host in legacy mode, but I'd much rather use Windows Terminal.

How can I keep these escape sequences out of my tmux sessions?

Original question text with bad assumptions below:

(I now believe this is an incorrect assumption, based on the response from @user1686 below).

OpenSSH for Windows (including the current beta 9.2p1) seems to push some extra characters that look like escape sequences. In a given command window, the first ssh session has garbage inserted, such that my fresh tmux session looks like the image below. Same deal from cmd, powershell, and cygwin terminal. This does not happen if the remote command is absent, or a virgin bash command. Mysteriously, it also doesn't happen on the second, fourth, etc ssh commands.

已采纳解答

原帖链接 · u1686_grawity · CC BY-SA 4.0

It's the terminal's response to an ESC [ c "Request terminal attributes" that was issued by the remote program.

(\033[c "Request terminal attributes" is one of several information requests that tmux outputs to the terminal, expecting to receive similar responses as input coming from the terminal (normally they would be invisibly consumed by tmux, just like special-key sequences are).

I'm not able to reproduce this with tmux 3.3a nor with 3.2a.

Mysteriously, it also doesn't happen on the second, fourth, etc ssh commands.

Your remote command is specifically written to start a new tmux session the first time but attach to an existing session on the second, fourth, etc. connections. It's natural that they would show different behavior.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-04-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。