microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.83k stars 28.45k forks source link

Task runs in wrong directory on WSL2 #177298

Closed parsley72 closed 8 months ago

parsley72 commented 1 year ago

Type: Bug

I've been using VSCode on Linux (Ubuntu 22.04). Since we have a Yocto build I added the command line instruction to tasks.json. It looks like:

        {
            "label": "build",
            "type": "shell",
            "command": "./example-build.sh --platform cv25 --extra-layers \"meta-layer\" --device-trees cv25_dvt_fastboot.dts --extra-packages \"ambarella-drivers-fastboot\" --remove-packages \"ambarella-drivers ambarella-load-ucode\" --fastboot-config source/my-app/fastboot_config_enabled.json",
            "options": {
                "cwd": "../../"
            },

This works fine on Linux but I've setup the same build in WSL2 and it doesn't notice the "cwd" field and runs the command in the wrong directory. I've tried changing the command to "../../example-build.sh" but that doesn't work either.

The command works fine if I use the terminal in the correct directory.

VS Code version: Code 1.76.2 (ee2b180d582a7f601fa6ecfdad8d9fd269ab1884, 2023-03-14T17:55:54.936Z) OS version: Windows_NT x64 10.0.22000 Modes: Sandboxed: No Remote OS version: Linux x64 5.15.90.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 5800H with Radeon Graphics (16 x 3194)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|39.37GB (13.66GB free)| |Process Argv|--crash-reporter-id b3ef5771-358f-4733-9406-ddabe5bf116d| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.90.1-microsoft-standard-WSL2| |CPUs|AMD Ryzen 7 5800H with Radeon Graphics (16 x 3194)| |Memory (System)|19.22GB (13.35GB free)| |VM|0%|
Extensions (26) Extension|Author (truncated)|Version ---|---|--- systemd-unit-file|coo|1.0.6 better-cpp-syntax|jef|1.17.2 jupyter-keymap|ms-|1.1.0 remote-wsl|ms-|0.76.1 doxdocgen|csc|1.4.0 vscode-markdownlint|Dav|0.49.0 gitlens|eam|13.3.2 bitbake|Eug|1.1.2 shell-format|fox|7.2.5 todo-tree|Gru|0.0.224 isort|ms-|2022.8.0 python|ms-|2023.4.1 vscode-pylance|ms-|2023.3.20 jupyter|ms-|2023.2.1200692131 jupyter-keymap|ms-|1.1.0 jupyter-renderers|ms-|1.0.15 vscode-jupyter-cell-tags|ms-|0.1.6 vscode-jupyter-slideshow|ms-|0.1.5 cmake-tools|ms-|1.13.45 cpptools|ms-|1.14.4 cpptools-extension-pack|ms-|1.3.0 vsliveshare|ms-|1.0.5834 vscode-xml|red|0.24.0 shellcheck|tim|0.29.4 cmake|twx|0.0.17 clang-format|xav|1.9.0 (2 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 vstes627:30244334 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 vscoreces:30445986 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30681850 azure-dev_surveyone:30548225 vscccc:30610679 pyindex848:30662994 nodejswelcome1:30587005 2e4cg342:30602488 pyind779:30671433 f6dab269:30613381 pythonsymbol12:30671437 2i9eh265:30646982 showlangstatbar:30672706 vsccsb:30677849 pythonb192:30669360 defaultazurewalk:30687958 pythonms35:30686772 ```
parsley72 commented 1 year ago

I worked around this by changing my setup to:

            "options": {
                "cwd": "${workspaceFolder}/../../"
            },
meganrogge commented 8 months ago

I think this is expected because you need to provide some reference point for the path.