【发布时间】:2022-01-30 13:13:07
【问题描述】:
我确定有一千个重复项,但我没有找到它们,因为我发现它们涉及本地终端,或者如果关于远程终端,则假定实时终端视图已经存在。在我的情况下,终端的“终端”方面尚不存在于终端窗格中。
设置:
安装在 Win 10 上的 Visual Studio Code 在基于 Linux 的系统上进行远程开发。
问题:
当我启动 Visual Studio Code 时,它会自动将自己附加到远程系统,这是应该的。
但是,编辑窗口底部的终端窗格不包含“终端”,(即提示我可以输入命令)。相反,它显示了 VS Code 努力连接远程机器的输出,如下所示:
其中包含大量文字:
93f51b4f790b: running
Acquiring lock on /home/pi/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/vscode-remote-lock.pi.899d46d82c4c95423fb7e10e68eba52050e30ba3
Found existing installation at /home/pi/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3...
Checking /home/pi/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3.log and /home/pi/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3.pid for a running server
Looking for server with pid: 4285
Starting server with command... /home/pi/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/server.sh --start-server --host=127.0.0.1 --enable-remote-auto-shutdown --port=0 --disable-telemetry &> "/home/pi/.vscode-server/.899d46d82c4c95423fb7e10e68eba52050e30ba3.log" < /dev/null
printenv:
SHELL=/bin/bash
PWD=/home/pi
LOGNAME=pi
XDG_SESSION_TYPE=tty
LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so
HOME=/home/pi
LANG=en_US.UTF-8
VSCODE_AGENT_FOLDER=/home/pi/.vscode-server
SSH_CONNECTION=172.31.100.209 1025 172.31.100.20 22
XDG_SESSION_CLASS=user
USER=pi
SHLVL=0
XDG_SESSION_ID=7
XDG_RUNTIME_DIR=/run/user/1000
SSH_CLIENT=172.31.100.209 1025 22
PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/mail/pi
_=/usr/bin/printenv
Spawned remote server: 22461
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
Waiting for server log...
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
*
93f51b4f790b: start
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==40669==
osReleaseId==raspbian==
arch==armv7l==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime==1088==
connectionToken==c996da7e-f0ac-4ecf-b214-07c49b988569==
93f51b4f790b: end
没有终端提示,也没有任何输入命令的方法。
(恕我直言,这应该在“输出”窗口而不是终端窗口中。)
如果我打开一个 python 文件并执行它,这个窗口会神奇地变成我可以使用的真实终端窗口。
出于这个原因,我创建了一个小型 Python 程序,只是为了强制终端窗口成为 终端 窗口:
# Open the terminal window
# A butt-ugly hack to force the VS Code terminal to be a terminal
print("Yippee! a terminal window!")
运行后,我的终端窗口是一个真正的终端窗口。这是一个丑陋的黑客,我相信有办法解决。
我的问题:
如何使我的终端成为真正的、活的、诚实的 Linux 终端,而无需运行任何东西?
谢谢!
【问题讨论】:
-
@Philippe 成功了。 Visual Studio Code 是一个如此“丰富”的环境,很容易忽略对其他人来说显而易见的东西。您可以将此作为答案发布,以便我可以为您接受吗?这是一个很好的答案,你应该为此获得荣誉。
标签: linux visual-studio-code terminal