From c78080801876613c7df204c8210a4f517b394e60 Mon Sep 17 00:00:00 2001 From: Sven Pfleiderer Date: Thu, 19 Feb 2026 13:29:50 -0800 Subject: [PATCH 1/2] Use signal.NotifyContext() instead of signal.Notify() boilerplat Entire-Checkpoint: 4d7e19fbfd1e --- cmd/entire/main.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cmd/entire/main.go b/cmd/entire/main.go index caad2ea9d..c2493f30a 100644 --- a/cmd/entire/main.go +++ b/cmd/entire/main.go @@ -14,16 +14,8 @@ import ( ) func main() { - // Create context that cancels on interrupt - ctx, cancel := context.WithCancel(context.Background()) - - // Handle interrupt signals - sigChan := make(chan os.Signal, 1) - signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) - go func() { - <-sigChan - cancel() - }() + // Create context that cancels on interrupt signals + ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) // Create and execute root command rootCmd := cli.NewRootCmd() From e63243b37475ceb2b857e1a49b96e4e70b23472b Mon Sep 17 00:00:00 2001 From: Victor Gutierrez Calderon Date: Fri, 20 Feb 2026 11:37:44 +1100 Subject: [PATCH 2/2] Remove signal handling and simplify to Execute() No command uses cmd.Context(), so the signal.NotifyContext setup was dead code. Switch from ExecuteContext to plain Execute. Co-Authored-By: Claude Opus 4.6 Entire-Checkpoint: 579b31e91172 --- cmd/entire/main.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/cmd/entire/main.go b/cmd/entire/main.go index c2493f30a..e1adc1690 100644 --- a/cmd/entire/main.go +++ b/cmd/entire/main.go @@ -1,25 +1,18 @@ package main import ( - "context" "errors" "fmt" "os" - "os/signal" "strings" - "syscall" "github.com/entireio/cli/cmd/entire/cli" "github.com/spf13/cobra" ) func main() { - // Create context that cancels on interrupt signals - ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) - - // Create and execute root command rootCmd := cli.NewRootCmd() - err := rootCmd.ExecuteContext(ctx) + err := rootCmd.Execute() if err != nil { var silent *cli.SilentError @@ -33,10 +26,8 @@ func main() { fmt.Fprintln(rootCmd.OutOrStderr(), err) } - cancel() os.Exit(1) } - cancel() // Cleanup on successful exit } func showSuggestion(cmd *cobra.Command, err error) {