main.go 372 B

12345678910111213141516171819202122232425
  1. package main
  2. import (
  3. "context"
  4. "os"
  5. "os/signal"
  6. "github.com/spf13/cobra"
  7. "github.com/ollama/ollama/cmd"
  8. )
  9. func main() {
  10. ctx, cancel := context.WithCancel(context.Background())
  11. defer cancel()
  12. sigChan := make(chan os.Signal, 1)
  13. signal.Notify(sigChan, os.Interrupt)
  14. go func() {
  15. <-sigChan
  16. cancel()
  17. }()
  18. cobra.CheckErr(cmd.NewCLI().ExecuteContext(ctx))
  19. }