tractor.dev/toolkit-go@v0.0.0-20241010005851-214d91207d07/engine/daemon/daemon_other.go (about)

     1  //go:build !linux
     2  
     3  package daemon
     4  
     5  import (
     6  	"os"
     7  	"os/signal"
     8  )
     9  
    10  // TerminateOnSignal waits for SIGINT, SIGKILL(?) to terminate the daemon.
    11  func TerminateOnSignal(d *Framework) {
    12  	termSigs := make(chan os.Signal, 1)
    13  	signal.Notify(termSigs, os.Interrupt, os.Kill)
    14  	<-termSigs
    15  	d.Terminate()
    16  }