大概一周前,当我在tmux中使用远程SSH扩展时,我注意到了一个奇怪的问题。在打开终端并启动tmux之后,在每个命令之后都会将以下内容打印到控制台:
-bash: __vsc_prompt_cmd_original: command not found
如果我检查Output选项卡的Log (Remote )部分,就会看到以下内容:
[2022-08-19 14:48:23.822] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q --header='Metadata:true' -O - http://169.254.169.254/metadata/instance?api-version=2019-03-11\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s --header='Metadata:true' http://169.254.169.254/metadata/instance?api-version=2019-03-11\n\tfi\nfi\nexit 0"]
[2022-08-19 14:48:23.890] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q -O - http://169.254.169.254/latest/meta-data/instance-id\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s http://169.254.169.254/latest/meta-data/instance-id\n\tfi\nfi\nexit 0"]
[2022-08-19 14:48:23.896] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q -O - http://169.254.169.254/metadata/v1/id\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s http://169.254.169.254/metadata/v1/id\n\tfi\nfi\nexit 0"]
[2022-08-19 14:48:23.900] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q --header='Metadata-Flavor:Google' -O - http://metadata.google.internal/computeMetadata/v1/instance/id\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s --header='Metadata-Flavor:Google' http://metadata.google.internal/computeMetadata/v1/instance/id\n\tfi\nfi\nexit 0"]
[2022-08-19 14:52:08.838] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/tmux" and args undefined
最后一行似乎是值得关注的,如果我将远程SSH扩展用于另一个主机( tmux工作的地方),则不会出现该行(使我相信该行为可能是连接的)。
两个远程主机都启用了终端集成(禁用终端集成似乎什么也不做)。在查看VSCode终端集成的设置时,我注意到tmux没有被列为支持终端集成的shell (只有bash、pwsh和zsh )。我还看到了一个警告,即命令可能也会破坏一些东西(我已经编辑了自己的PS1
,以打印我所在的github分支,尽管它在另一个远程主机上运行得很好)。设置中的链接(我在这里已经复制了)被破坏了,页面上没有#_complex-bash-promptcommand
锚,所以这可能是一条红鲱鱼。
有什么想法吗?我应该提交一个VSCode问题吗?我在这里完全迷路了吗?
发布于 2022-09-21 09:30:54
您可以测试以下方法。
使用像nano或vim这样的编辑器,添加行
unset PROMPT_COMMAND
到您的.bashrc文件中,它将在下一次会话中生效。
若要立即将更改应用于当前shell会话的生存期,请键入
unset PROMPT_COMMAND
在你的终端窗口。
https://stackoverflow.com/questions/73421978
复制相似问题