-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.bashrc updates are not available in tasks (unlike locally) #3224
Comments
Does the vscode-remote-try-dotnetcore example work for you? |
yes, the example works, but it only uses net core. Would you have an example that uses npm? or some project created by
|
@chrmarti It looks like |
@Chuxel We disabled that for #544. We could make that an option or maybe there is a way of running the task inside a shell. @AndersonSFerreira What does your tasks.json look like? |
@chrmarti To be clear, things are fine in the terminal, it's just tasks that fail. The issue you reference is talking about the terminal. This is actually going to be a problem for using nvm in tasks in general since it has to These are pre-created scripts from .NET Core and its triggered by the CLI itself, so I'm not sure we can modify it. Here's the generated tasks.json:
EDIT: The |
@AndersonSFerreira Here's a workaround:
@chrmarti I don't understand why the VS Code process wouldn't be passing along environment variables set in |
@Chuxel We start the server without using a shell to avoid relying on specific shell behavior. This is similar to what tasks does for If NVM had a symlink to the current Node install, we could use The terminal now has a setting to turn off inheriting the environment variables. Maybe that is a better fix for #544 than to not read the shell environment. Or: We make reading the shell environment an option, but ideally we don't add more options if we don't have to. |
Correct - there's no way to use
Here's the thing, even with type I'm also not 100% sure we should be removing the env vars as much as merging as was proposed in #544. (I'm potentially missing some offline convos on where this landed.) |
It works locally with tasks on Mac because VS Code reads the env with The same code can be run by the VS Code Server, but we disabled it for #544. The problem in #544 is specific to containers (or at least these minimal Linux installs) because the Maybe a better fix for #544 would be to change the shell profile to not overwrite the existing |
Got it. Yeah, it seems like we would want things already in the path to take precedence over what we append during startup. That's why I'd assumed that was a pretty trivial change (it's just concatenation at that point). The only other alternative I can think of is to preserve the original PATH in an alternate one (ORIG_PATH) that can be added to processes as you'd see locally along with all other env vars. |
@chrmarti Ok - shall we flip this to a bug to investigate? I did find another workaround for @AndersonSFerreira Just tweak your Dockerfile as by changing:
...to...
|
…e-release-3224 Work around microsoft/vscode-remote-release#3224
Outputs:
Without the
It seems one possible fix would be to use only |
@chrmarti Yeah that is what I have been doing in the vscode-dev-containers test scripts actually ( |
EDIT: ^- This may be Codespaces specific. |
In case this helps Codespaces: You can start We might want to do our own probing for Remote-Containers using only |
adding these lines made the project work |
Interestingly NVM doesn't work in local VS Code's tasks either because it is a function and these are not extracted by shellEnv.ts. E.g., this task doesn't work: {
"version": "2.0.0",
"tasks": [
{
"label": "testenv",
"command": "nvm",
"type": "process",
"args": [
"ls"
]
}
]
} |
@chrmarti Interesting - what I did to see if I got the right version of Node was this: {
"version": "2.0.0",
"tasks": [
{
"label": "testenv",
"command": "which",
"type": "process",
"args": [
"node"
]
}
]
} For me returns I'll have to try on a Linux machine to see if things are different there. |
I see our Node 12 DevContainer image take 500-600ms for running |
To avoid everyone seeing a performance impact from a fix to this we could add a |
@chrmarti That sounds like a reasonable approach! |
Using |
Is there any way we can specify the type of 'env probe' at the container/image level without having to configure every named container we start? It is a bit of a hassle to connect, modify the named container config, disconnect, then reconnect every time we start a container with a different name/image. e.g Could there be a 'VSCODE_ENV_PROBE=login' machine based environment variable we set in the Dockerfile/image? Or just a default type of 'env probe' for all containers? As an aside, it seems like an unusual name for the configuration option given it is effectively determining the way vscode connects rather than 'probes'. This is in reference to #3585 |
Using vscode and .NET Core 2.1, I created a new ASP.NET Core Web App (Angular), when trying to utilize VS Code Remote Development (Containers). I copied the Dockerfile from the vscode-remote-try-dotnetcore example. Everything seems to compile just fine, but I get a runtime error:
Running $PATH on remote:
As you can see, the $PATH does include /home/vscode/.nvm/versions/node/v12.18.1/bin, though I'm not sure why this doesn't match the path that the command npm spits out.
I'm not sure what to do here to get it to work.
The text was updated successfully, but these errors were encountered: