How does nRF Connect for VS Code determine the shell for default "Build" and "Flash" tasks?

I installed west and other additional Python dependencies in a Python virtual environment. Therefore, when I run the "Build" task from the Actions View, the task failed with an error message:

/bin/sh: west: command not found

I know that the integrated terminal can activate the Python virtual environment when sourcing a shell configuration file, and therefore I can run west build in the integrated terminal successfully.

Eventually, I do want the tasks in the Actions View to successfully run west as well. And to do this without forgoing the virtual environment, I believe I need to better understand how nRF Connect for VS Code determines the shell for tasks in the Actions View.

I'm on macOS 13.3.1 using nRF Connect for VS Code 2023.4.148. It looks like the tasks in the Actions View use /bin/sh as their shell.

As far as I'm aware, setting "terminal.integrated.automationProfile.osx".path in settings.json or "options.shell" in tasks.json does not change the shell for tasks in the Actions View. Nor does setting "nrf-connect.west.env" in settings.json help. "nrf-connect.taskBindings" will overwrite the default tasks in the Actions View.

Any clarification on how nRF Connect for VS Code determines the shell for tasks in the Actions View is appreciated.

Parents Reply Children
  • I tried setting the $PATH environment variable in .bashrc, as well as in "nrf-connect.west.env" from settings.json. Running the "Build" task from the Actions View still fails after performing either procedure with an error message:

    /bin/sh: west: command not found

    I initially thought that nRF Connect for VS Code would, by default, use my default shell on my macOS computer, which is /bin/zsh. It does for the nRF Connect terminal profile, but not for tasks in the Actions View (seems that they default to /bin/sh). Is there a way to change the shell for tasks in the Actions View?

  • Hi,

    Can you try starting VS Code from within the environment where all PATHs are set to your wanted toolchain? This should help VS Code inherit the same environment.

    Best regards,
    Marte

Related