Dependency hangs on rebuild
I have configured in my Taskfile a few tasks, one for building tailwind styles, one for building SQLC code, and then one that builds my Go program but has the other 2 tasks as dependencies. I want to create a parent task to run this build output binary, and rebuild it whenever any file changes, currently that has left me with this Taskfile:
There is two problems I have with this though...
- The first is super minor and I'm not bothered much by it, but that's that on first run of
task live
Taskfile will see all the deps are up to date, run the cmd bin/app
and then instantly kill it. This isn't too bad, as on second run Taskfile doesn't just kill the command so all is great, however, the second problem is a roadblock.
- The second problem is that if I make any changes that would cause build:go:app
to rerun, it hangs forever on the cmd go build -o bin/app cmd/app/main.go
. Now, if I run that task directly it's fine, no hang, but if Taskfile reruns that task due to a file change causing the re-eval then it hangs forever. My terminal logs look like this when I make a change:
and it just hangs forever on task: [build:go:app] go build -o bin/app cmd/app/main.go
.
If any more info is needed to debug just let me know, or if there is some better way to go this whole thing.2 Replies
One update, I think the first issue is just this bug reported here: https://github.com/go-task/task/issues/2202
GitHub
Watch sends interrupt signal right away in v3.43.x · Issue #2202 ...
Description Upgrading from v3.42.1 to v3.43.x (both .1 and .2) breaks the --watch functionality. Using an older version, for example, v3.42.1, works as it should: ❯ task --version Task version: v3....
I haven't found a solution yet, but a decent work around is to just save the file twice. When I save it the first time it just hangs forever on the
build:go:app
task, but saving again causes it to no longer hang and it rebuilds successfully.