package util import ( "context" "os" "os/signal" "path/filepath" "strings" "syscall" ) var ( workdir string ) func WaitTerminal(cancel context.CancelFunc) { sigc := make(chan os.Signal, 1) signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) defer signal.Stop(sigc) <-sigc cancel() } func GetWorkPath() string { if workdir == "" { workdir, _ = filepath.Abs(".") } return workdir } func Merge(arr ...string) string { return strings.Join(arr, "") }