簡體   English   中英

vscode-remote-container 在 post*Command 后打開用戶終端

[英]vscode-remote-container open user terminal after post*Command

如果您運行post*Command ,您將獲得一個運行命令和輸出的集成終端:

從 devcontainer.json 運行 PostCreateCommand...

[2709 毫秒] 開始:在容器中運行:...

完畢。 按任意鍵關閉終端。

有沒有辦法讓這個自動關閉並打開一個用戶終端,或者只是離開它並打開一個用戶終端,就好像你根本沒有運行來自devcontainer.json的任何命令一樣?

使用涉及 Python 的示例,您可以嘗試使用postAttachCommand

{
    "postCreateCommand": ["poetry", "install"],
    "postAttachCommand": "bash"
}

這使:

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#

postCreateCommand的描述如下:

創建容器后要運行的命令。 此命令在 "updateContentCommand" 之后和"postStartCommand" 之前運行。

postAttachCommand的描述指定:

附加到容器時運行的命令。 此命令在“postStartCommand”之后運行。

所以其他變化可能是可能的,但這個對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM