diff --git a/cmd/notation/main.go b/cmd/notation/main.go index 7f33a1202..c78c70324 100644 --- a/cmd/notation/main.go +++ b/cmd/notation/main.go @@ -14,7 +14,9 @@ package main import ( + "context" "os" + "os/signal" "github.com/notaryproject/notation-go/dir" "github.com/notaryproject/notation/cmd/notation/blob" @@ -65,7 +67,10 @@ func main() { versionCommand(), inspectCommand(nil), ) - if err := cmd.Execute(); err != nil { + + ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) + defer cancel() + if err := cmd.ExecuteContext(ctx); err != nil { os.Exit(1) } }