Hey 👋
I guess I have found a bug yesterday on task: It looks like previously defined environment variable are not overwritten by the definition within the task file.
Taskfile
version: '3'
silent: true
tasks:
default:
env:
KEY: 'other'
cmds:
- echo "$KEY"
Expected
I would expect the environment variable of KEY to be overwritten whatever the outside environment looks like.
$ task
other
$ KEY=some task
other
Actual
The environment variable from the outside shell takes precedence over the variable defined within the taskfile.
$ task
other
$ KEY=some task
some
Os + Taskfile-version
$ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=21.1
DISTRIB_CODENAME=vera
DISTRIB_DESCRIPTION="Linux Mint 21.1 Vera"
$ task --version
Task version: v3.21.0 (h1:pVGAGXxJ9Pk5mvjqv/CsdAD4ZIzNMjF+vrXMueM/WFk=)
Why is that problem?
- I have not found any reference to that behavior in the docs.
- I love to clearly define my environment when using
task rather than relying on any other outer state. In that case it's impossible to overwrite previously defined variables which may be a huge issue.
Hey 👋
I guess I have found a bug yesterday on task: It looks like previously defined environment variable are not overwritten by the definition within the task file.
Taskfile
Expected
I would expect the environment variable of KEY to be overwritten whatever the outside environment looks like.
Actual
The environment variable from the outside shell takes precedence over the variable defined within the taskfile.
Os + Taskfile-version
$ cat /etc/lsb-release DISTRIB_ID=LinuxMint DISTRIB_RELEASE=21.1 DISTRIB_CODENAME=vera DISTRIB_DESCRIPTION="Linux Mint 21.1 Vera" $ task --version Task version: v3.21.0 (h1:pVGAGXxJ9Pk5mvjqv/CsdAD4ZIzNMjF+vrXMueM/WFk=)Why is that problem?
taskrather than relying on any other outer state. In that case it's impossible to overwrite previously defined variables which may be a huge issue.