package executor import ( "fmt" "os" "os/signal" "syscall" "github.com/spf13/cobra" ) var ( executorServer *Server ExecutorCmd = &cobra.Command{ Use: "executor", Short: "Privileged daemon", RunE: func(cmd *cobra.Command, args []string) error { return startExecutorCmd() }, } ) func startExecutorCmd() error { executorServer = &Server{} sigCh := make(chan os.Signal, 1) signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM) go func() { <-sigCh executorServer.Stop() }() if err := executorServer.Start(); err != nil { return fmt.Errorf("failed to start executor server: %w", err) } return nil }