task icon indicating copy to clipboard operation
task copied to clipboard

`--watch` should start new process after old process stopped

Open trim21 opened this issue 1 year ago • 2 comments

  • Task version: 3.36.0
  • Operating system: debian 10
  • Experiments enabled: no

I have a simple go program

package main

import (
	"io"
	"log"
	"net/http"
)

func main() {
	http.HandleFunc("/", func(writer http.ResponseWriter, r *http.Request) {
		print(r.URL.Query().Encode())
		io.WriteString(writer, "hello world 2")
	})

	log.Fatal(http.ListenAndServe(":8001", http.DefaultServeMux))
}

and task file:

version: 3

tasks:
  s:
    sources:
      - '*.go'
    cmd: go run main.go

whan I run it with task s --watch I encounter a error with 2024/05/02 13:38:59 listen tcp :8001: bind: address already in use.

It looks like task didn't stop old process cleanly before it start a new process?

trim21 avatar May 02 '24 05:05 trim21

this works as expected

version: 3

tasks:
  build:
    sources:
      - '*.go'
    generates:
      - out
    cmd: go build -o out main.go

  s:
    deps: [ build ]
    cmd: ./out

trim21 avatar May 02 '24 05:05 trim21

I can confirm that this works but the first one not

this works as expected

version: 3

tasks:
  build:
    sources:
      - '*.go'
    generates:
      - out
    cmd: go build -o out main.go

  s:
    deps: [ build ]
    cmd: ./out

eduardolat avatar Oct 14 '24 21:10 eduardolat