package daemon

import (
	"os"
	"os/signal"
	"syscall"
)

var (
	Interrupt           = os.Interrupt
	Quit      os.Signal = syscall.SIGQUIT
	Terminate os.Signal = syscall.SIGTERM
)

func WaitForSignal(sig ...os.Signal) os.Signal {
	ch := make(chan os.Signal, 1)
	signal.Notify(ch, sig...)

	return <-ch
}

func WaitForSignalsDefault() os.Signal {
	return WaitForSignal(Interrupt, Quit, Terminate)
}
