task
task copied to clipboard
Strange env var override behavior
If set some variable with shell, and override it with task parameter, then task will in some cases use one parameter and in some - another.
Taskfile.yml
version: 3
env:
SOME_PATH: '{{if not (empty .PATH_PART)}}/some/path/{{.PATH_PART}}/file.txt{{else}}{{fail "PATH_PART not set!"}}{{end}}'
tasks:
default:
cmds:
- echo _${PATH_PART}_
- echo _{{.PATH_PART}}_
- echo _${SOME_PATH}_
- echo _{{.SOME_PATH}}_
Bug reproduce steps:
$ PATH_PART=foo task PATH_PART=bar
task: [default] echo _${PATH_PART}_
_foo_
task: [default] echo _bar_
_bar_
task: [default] echo _${SOME_PATH}_
_/some/path/bar/file.txt_
task: [default] echo _/some/path/foo/file.txt_
_/some/path/foo/file.txt_
$ task PATH_PART=bar
template: :1:73: executing "" at <fail "PATH_PART not set!">: error calling fail: PATH_PART not set!
$ PATH_PART=foo task
task: [default] echo _${PATH_PART}_
_foo_
task: [default] echo _foo_
_foo_
task: [default] echo _${SOME_PATH}_
_/some/path/foo/file.txt_
task: [default] echo _/some/path/foo/file.txt_
_/some/path/foo/file.txt_
- Task version: v3.39.0 (h1:Loe6ppP1x38Puv1M2wigp91bH/garCt0vLWkJsiTWNI=)
- Operating system: Windows 10 Pro x64
- Experiments enabled: