Skip to content
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

Running tasks from sidebar doesn't set the {{.PWD}} variable to the open folder's directory. #166

Open
WinkelCode opened this issue Sep 30, 2024 · 0 comments

Comments

@WinkelCode
Copy link

WinkelCode commented Sep 30, 2024

Example:

version: "3"

tasks:
  default:
    cmds:
      - echo "{{.PWD}}"

Running from terminal:

$ task
task: [default] echo "/Volumes/Projects/Code_Projects/LinuxEnv"
/Volumes/Projects/Code_Projects/LinuxEnv

Running from sidebar:

task: [default] echo "/"
/
task: completed with code 0

The most logical behavior would be to set the PWD to the root of the opened folder.


  • Task version:
$ task --version
Task version: 3.39.2 ()
  • Operating System: macOS 15.1

Update: I observe the same behavior with USER_WORKING_DIR.

Update 2: Never mind, I added USER_WORKING_DIR in the wrong spot, it does work! I wonder why PWD doesn't, then again I don't see it documented?

Update 3: Interesting, I just tried it with {{.SHELL}} and in it works in both cases. So I guess that in my previous test, PWD came from the environment, maybe it needs to be explicitly set when running from the sidebar?

I am inclined to just close this issue as being user error, but I feel like it's just weird enough (confused me a for a bit) that it might be worth it to set the PWD variable in the VSCode extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant