Issue Type: Bug
similar to https://github.com/Microsoft/vscode/issues/45423
node v10.6.0
npm 6.1.0
launch.json contents:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"useWSL": true,
"runtimeArgs": [
"--experimental-modules"
],
"env": {
"SQLITEFILE": "chap07.sqlite3",
"NOTESMODEL": "sqlite3"
},
"program": "${workspaceFolder}\\bin\\www.mjs"
}
]
}
cannot access NOTESMODEL via process.env.NOTESMODEL
VS Code version: Code 1.25.1 (1dfc5e557209371715f655691b1235b6b26a06be, 2018-07-11T15:43:53.668Z)
OS version: Windows_NT x64 10.0.17134
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) m3-7Y30 CPU @ 1.00GHz (4 x 1608)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: enabled
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled|
|Memory (System)|7.89GB (3.72GB free)|
|Process Argv|C:Program FilesMicrosoft VS CodeCode.exe|
|Screen Reader|no|
|VM|0%|
Extensions (6)
Extension|Author (truncated)|Version
---|---|---
Handlebars|and|0.4.1
vscode-eslint|dba|1.4.12
mssql|ms-|1.4.0
cpptools|ms-|0.17.6
debugger-for-chrome|msj|4.8.0
html-css-class-completion|Zig|1.17.1
We just announced remote development with VS Code, check out the blog post for details https://code.visualstudio.com/blogs/2019/05/02/remote-development
It looks like this doesn't work with VS Code Remote WSL. I started with the helloworld-sample code. https://github.com/Microsoft/vscode-extension-samples
I added:
console.log(process.env.HELLO);
in the command.
I added
"env": {
"HELLO": "yellow"
}
To the launch config.
When running locally, that the console.log prints "yellow".
When running in VS Code Remote WSL, that console.log prints undefined.
Edit: Note that this is with the extensionHost debug type.
I run a normal node programm in a WSL Remote window and env variables are correctly passed. So it looks that what @alexr00 found is a possible issue related to extension host development
Here's my example:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"runtimeArgs": [
"--experimental-modules"
],
"env": {
"SQLITEFILE": "chap07.sqlite3",
"NOTESMODEL": "sqlite3"
},
"program": "${workspaceFolder}/index.js"
}
]
}
index.js
console.log(Object.keys(process.env).join('\n'))
The output contains SQLITEFILE and NOTESMODEL
I've changed the title to better reflect the real problem
are there any workarounds that still uses wsl?
@hsm207 are you using the legacy "useWSL" support or the "Remote - WSL" extension?
@weinand I am using ms-vscode-remote.remote-wsl version 0.44.2.
This is the version of VS Code I'm using:
Version: 1.45.0-insider (user setup)
Commit: 44c5185373d5f209cd6c0b5d29a216fb801da34e
Date: 2020-04-10T18:12:33.780Z
Electron: 7.2.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041
@hsm207 how does your WSL launch config look like?
@weinand how do I check my WSL launch config?
It is the launch configuration from your launch.json that you use to debug your program (under WSL). The original comment on this issue shows a launch config.
@weinand
Here's the launch.json:
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"env": {
"JULIA_NUM_THREADS": "3"
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/**/*.js" ],
"preLaunchTask": "npm: compile"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/out/test/**/*.js" ],
"preLaunchTask": "npm: compile"
}
]
}
In WSL, process.env["JULIA_NUM_THREADS"] is undefined but on Windows it is 3.
Just updated my VS Code to this but the problem still persists:
Version: 1.45.0-insider (user setup)
Commit: 1c36d747fbf113144d3bf82b0aa3cbd290714e38
Date: 2020-04-15T05:37:18.376Z
Electron: 7.2.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041