v3.0.0-preview3Hi, thanks for the great work!
Task v3 evaluates shell commands before running the task - for example when running task --list.
This is not the behaviour in v2 and doesn't make sense as a lot of tasks depend on previous tasks.
Example:
version: '3'
tasks:
foo:
desc: foo
cmds:
- echo $MSG
env:
MSG: {sh: 'sleep 10; echo hi'}
Running task --list will sleep for 10 seconds.
In v2 it will just work as expected :)
Same bug occurs under vars: so I guess it has to do with the shell evaluation.
If you point me into a direction that might cause this behaviour I can add a PR to fix it.
Thanks!
Hi @ronlut,
It's possible that the behavior is completely different in the v3 branch currently as it was refactored a few days ago (and not yet released on the preview channel). It'd be nice if you could try it.
Or if you don't want to build from source, I plan to release the last v3 preview release soon (before it goes to stable).
Checked with latest commit on v3 branch - bug still exists.
Hi @ronlut,
I just figured out what's happening. Actually this is not a v3 issue, it's also on v2, but only starting on the v2.8.1 release, which was made later in the same day you opened this issue.
This was caused by #276 and #283, i.e. someone couldn't use variables on desc before this patch.
To be honest, I'm not sure about what to do here. That a valid feature request, but comes with this drawback of making stuff slow if you have slow dynamic variables (which people should usually avoid if possible).
Hi, thanks for the reply.
I don't think it's only a problem with slow variables.
It may fail task --list in various scenarios. If you use vars somewhere in the shell it will fail as when running task --list you don't provide any vars - you just want to know what tasks are available.
Perhaps we should skip errors on variables when using --list and just print a blank string
We could also set a timeout for these shell when on --list (1 second? 0.5?)
Shell tab-completion is also affected by this. Which can make it very slow, or even not work at all when a command fails.
Any updates on this? This seems like a pretty big regression to have in the code base for so many releases.
Most helpful comment
Hi, thanks for the reply.
I don't think it's only a problem with slow variables.
It may fail
task --listin various scenarios. If you use vars somewhere in the shell it will fail as when runningtask --listyou don't provide any vars - you just want to know what tasks are available.