Description
Variables declared under vars are exported into the environment of sh: (dynamic variable) commands, but not into cmds, status or preconditions.
The behaviour is undocumented.
vars and env are documented as separate concepts, so I expected MY_VAR not to be in the environment at all.
Or, if it is exported, to be exported consistently in both places.
Version
3.53.1
Operating system
Linux
Experiments Enabled
No response
Example Taskfile
version: '3'
vars:
MY_VAR: leaked
tasks:
default:
silent: true
vars:
FROM_SH:
sh: 'echo "MY_VAR=$MY_VAR"'
cmds:
- 'echo "dynamic var (sh:) sees {{.FROM_SH}}"'
- 'echo "cmds sees MY_VAR=$MY_VAR"'
Description
Variables declared under
varsare exported into the environment ofsh:(dynamic variable) commands, but not intocmds,statusorpreconditions.The behaviour is undocumented.
varsandenvare documented as separate concepts, so I expectedMY_VARnot to be in the environment at all.Or, if it is exported, to be exported consistently in both places.
Version
3.53.1
Operating system
Linux
Experiments Enabled
No response
Example Taskfile