Major Refactoring, Client can now be used as a library
Some checks failed
Build (artifact) / build (push) Failing after 1m3s
Some checks failed
Build (artifact) / build (push) Failing after 1m3s
This commit is contained in:
37
app/executor/commands.go
Normal file
37
app/executor/commands.go
Normal file
@@ -0,0 +1,37 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user