Skip to content

Bug: In watch mode, when sources are present in another task, defer statements run after re-running the task #1413

Open
@20manas

Description

@20manas

Expected Behavior: Regardless of where the sources are, if files are being watched and a file among them changes, defer statements should always run before running the task again.

Taskfile:

version: '3'

tasks:
  server:
    watch: true
    sources: 
      - '**/*.go'
    generates:
      - './tmp/main'
    cmds:
      - go build -o ./tmp/main ./cmd/something/
      - ./tmp/main

  
  abc:
    watch: true
    cmds:
      - echo "started"
      - defer: echo "ended"
      - task: server

Output:

image

  • Task version: v3.31.0
  • Operating system: Linux
  • Experiments enabled: no

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: watcherChanges related to the Taskfile watcher.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions