You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
487 B

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, "")
}