[英]vscode-remote-container open user terminal after post*Command
if you run a post*Command
you get an integrated terminal that runs the command(s) and outputs:如果您运行
post*Command
,您将获得一个运行命令和输出的集成终端:
Running the PostCreateCommand from devcontainer.json...
从 devcontainer.json 运行 PostCreateCommand...
[2709 ms] Start: Run in container: ...
[2709 毫秒] 开始:在容器中运行:...
Done.
完毕。 Press any key to close the terminal.
按任意键关闭终端。
is there a way to have this auto close and open a user terminal or just leave it and open a user terminal as if you werent running any commands from devcontainer.json
at all?有没有办法让这个自动关闭并打开一个用户终端,或者只是离开它并打开一个用户终端,就好像你根本没有运行来自
devcontainer.json
的任何命令一样?
Using an example involving Python, you can try using postAttachCommand
:使用涉及 Python 的示例,您可以尝试使用
postAttachCommand
:
{
"postCreateCommand": ["poetry", "install"],
"postAttachCommand": "bash"
}
which gives:这使:
Running the postCreateCommand from devcontainer.json...
[28000 ms] Start: Run in container: poetry install
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: project (0.1.0)
Running the postAttachCommand from devcontainer.json...
[33815 ms] Start: Run in container: /bin/sh -c bash
root@a0fd27a3b2cc:/workspaces/directory#
The description for postCreateCommand
reads: postCreateCommand
的描述如下:
A command to run after creating the container.
创建容器后要运行的命令。 This command is run after "updateContentCommand" and before "postStartCommand" .
此命令在 "updateContentCommand" 之后和"postStartCommand" 之前运行。
whereas the description for postAttachCommand
specifies:而
postAttachCommand
的描述指定:
A command to run when attaching to the container.
附加到容器时运行的命令。 This command is run after "postStartCommand".
此命令在“postStartCommand”之后运行。
So other variations might be possible, but this one worked for me.所以其他变化可能是可能的,但这个对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.