DamionGans / ubuntu-wsl2-systemd-script

[Does not work anymore!] Script to enable systemd support on current Ubuntu WSL2 images
1.56k stars 383 forks source link

vscode is using the wrong directory in default terminal. #22

Open scotty-c opened 4 years ago

scotty-c commented 4 years ago

When you open a terminal inside vscode within WSL2 it is defaulting to /mnt/c/Users/username/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.3 not the folder you open it in. I understand that its getting it from the ~/.system-env file and we are setting the env with this command cmd.exe /C setx WSLENV BASH_ENV/u

More than happy to work on a PR to help fix the issue. I am not 100% sure what this command cmd.exe /C setx WSLENV BASH_ENV/u is setting

2001zhaozhao commented 4 years ago

For me the VSCode terminal opens in the correct folder, but when directly executing a command, such as "wsl ls" it always executes in the root folder after installing this script.

enzy commented 4 years ago

My terminal fails to launch completely in the VSCode. It prints out this message and exits: 87141613-985e5c00-c2a3-11ea-888a-a64671c5e0c0

https://github.com/microsoft/vscode/issues/102090

This might be causing the problem 🤷 https://github.com/DamionGans/ubuntu-wsl2-systemd-script/blob/ca7b15b082d1bf23f43123a019e61ad0926fabbd/enter-systemd-namespace#L45-L47

mogzol commented 4 years ago

I'm getting the same error as @enzy, and also an error from xargs: image

scotty-c commented 4 years ago

@diddledan Any ideas on this one, I am free to help out with a PR

wildan2711 commented 3 years ago

Getting the same problem, all my terminals in vscode always open in: /mnt/c/Users/wilda/AppData/Local/Programs/Microsoft VS Code

kvnloughead commented 2 years ago

Anyone found any solutions to this? I'm stumped. I tried comparing the output of code . --verbose in my distro that is starting in the wrong directory (first block) with one that is working properly (second). They seem to be the same

Invoking: cd "/mnt/c/Users/kvnlo/AppData/Local/Programs/Microsoft VS Code" && ELECTRON_RUN_AS_NODE=1 
"/mnt/c/Users/kvnlo/AppData/Local/Programs/Microsoft VS Code/Code.exe" "resources/app/out/cli.js" 
"--ms-enable-electron-run-as-node" "--verbose" 
"--folder-uri=vscode-remote://wsl+Ubuntu-20.04/home/kevin/dev/blog" "--remote=wsl+Ubuntu-20.04"
Invoking: cd "/mnt/c/Users/kvnlo/AppData/Local/Programs/Microsoft VS Code" && ELECTRON_RUN_AS_NODE=1
"/mnt/c/Users/kvnlo/AppData/Local/Programs/Microsoft VS Code/Code.exe" "resources/app/out/cli.js"
"--ms-enable-electron-run-as-node" "--verbose" 
"--folder-uri=vscode-remote://wsl+Ubuntu-20.04/home/kevin/dev/blog" "--remote=wsl+Ubuntu-20.04"
GergelyKovach commented 2 years ago

I know for many of you systemd is required. For me the solution was to uninstall: https://github.com/FiestaLake/ubuntu-wsl2-systemd-script/blob/master/uninstall.sh Now the folder in terminal is good again

Yamboy1 commented 2 years ago

Sadly I had to do this as well