'Visual Studio Code, container: terminal hangs very long before prompt appears
I'm using Visual Studio Code to develop within a Docker container (notably, mcr.microsoft.com/vscode/devcontainers/javascript-node:0-12).
This is the content of my settings.json file:
{
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/usr/bin/flatpak-spawn",
"args": [
"--host",
"--env=TERM=xterm-256color",
"bash"
]
}
}
}
When I issue any command in the terminal, it executes correctly, but it takes very long for the prompt to appear again.
What is causing this behaviour? How can the problem be solved?
Solution 1:[1]
It turned out that the delay was due to a combination of:
- poor container's file system behaviour because bind-mount'ed to the local machine's one (Linux container on Windows machine)
- project consisting of a large number of (small, actually) source files (~10,000)
- git information displayed on the prompt
To solve the issue, I ended up disabling git's processing every time (as described at https://giters.com/ohmyzsh/ohmyzsh/issues/9848 ), by adding a postCreateCommand in devcontainer.json file.
This is the content of my devcontainer.json:
"postCreateCommand": "git config --global oh-my-zsh.hide-info 1 && git config --global oh-my-zsh.hide-status 1 && git config --global oh-my-zsh.hide-dirty 1"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
