You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Variables declared under vars are exported into the environment of sh: (dynamic variable) #2993
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: leakedtasks:
default:
silent: truevars:
FROM_SH:
sh: 'echo "MY_VAR=$MY_VAR"'cmds:
- 'echo "dynamic var (sh:) sees {{.FROM_SH}}"'
- 'echo "cmds sees MY_VAR=$MY_VAR"'
@eitsupi yes, this is how it works. Yes, it should probably work differently, but it works this way ... so this is how to deal with it. Choose the strategy that works best for you.
Activity
trulede commentedon Aug 20, 2026
@eitsupi yes, this is how it works. Yes, it should probably work differently, but it works this way ... so this is how to deal with it. Choose the strategy that works best for you.
gives