github.com/nektos/act@v0.2.63/main.go (about) 1 package main 2 3 import ( 4 "context" 5 _ "embed" 6 "os" 7 "os/signal" 8 "syscall" 9 10 "github.com/nektos/act/cmd" 11 ) 12 13 //go:embed VERSION 14 var version string 15 16 func main() { 17 ctx := context.Background() 18 ctx, cancel := context.WithCancel(ctx) 19 20 // trap Ctrl+C and call cancel on the context 21 c := make(chan os.Signal, 1) 22 signal.Notify(c, os.Interrupt, syscall.SIGTERM) 23 defer func() { 24 signal.Stop(c) 25 cancel() 26 }() 27 go func() { 28 select { 29 case <-c: 30 cancel() 31 case <-ctx.Done(): 32 } 33 }() 34 35 // run the command 36 cmd.Execute(ctx, version) 37 }