-
-
Notifications
You must be signed in to change notification settings - Fork 625
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
dir in task is buggy when using variables #1838
Comments
I don't see anything wrong here. Some more context about what you're trying to do might help. |
My bad, I posted a wrong example. Sorry for that, and I have update the original post. The bug is sub-task's dir creates a new sub-folder and execute on that new sub-folder, but location is set to /tmp |
version: '3'
vars:
LOC: "/tmp"
tasks:
test:
dir: "{{.LOC}}/a"
vars:
a:
sh: "echo 1 |grep 1"
cmds:
- echo "dir is {{.LOC}}"
- pwd
Also, if use sh for variable also behave buggy, looks like the grep command somehow affecte the location, which should be |
I'm having the same issue: > mkdir /tmp/{a,b}
> cd /tmp/a
> task -v
task: [/tmp/a] Not found - Using alternative (Taskfile.yaml)
task: "default" started
task: [default] echo tmpdir = $TMP
tmpdir = /tmp/b
task: [default] echo inside dir $PWD
inside dir /tmp/a
task: "default" finished Taskfile.yaml version: '3'
dotenv: [.env]
vars:
tmpdir: $TMP
tasks:
default:
dir: "{{ .tmpdir }}"
cmds:
- echo tmpdir = {{ .tmpdir }}
- echo inside dir $PWD .env TMP=/tmp/b |
Task version: Task version: v3.38.0 (h1:O7kgA6BfwktXHPrheByQO46p3teKtRuq1EpGnFxNzbo=)
Operating system: Ubuntu 2204
Experiments enabled: No
I suppose it should be /tmp? If I change to
dir: "/{{.location}}"
, it become what I expect.also, if I change to:
output is also correct:
The text was updated successfully, but these errors were encountered: