From b609a187bff897eb1a56b59be46ca1f6dac06f40 Mon Sep 17 00:00:00 2001 From: BolajiOlajide <25608335+BolajiOlajide@users.noreply.github.com> Date: Tue, 21 Jun 2022 16:07:20 +0100 Subject: [PATCH] handle SIGTERM in ctx --- cmd/src/batch_common.go | 3 ++- cmd/src/batch_preview.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/src/batch_common.go b/cmd/src/batch_common.go index 6a78d8f296..c455975191 100644 --- a/cmd/src/batch_common.go +++ b/cmd/src/batch_common.go @@ -12,6 +12,7 @@ import ( "path/filepath" "runtime" "strings" + "syscall" "time" "github.com/mattn/go-isatty" @@ -533,7 +534,7 @@ func checkExecutable(cmd string, args ...string) error { func contextCancelOnInterrupt(parent context.Context) (context.Context, func()) { ctx, ctxCancel := context.WithCancel(parent) c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { select { diff --git a/cmd/src/batch_preview.go b/cmd/src/batch_preview.go index 088c58046e..9ff1077db2 100644 --- a/cmd/src/batch_preview.go +++ b/cmd/src/batch_preview.go @@ -5,10 +5,10 @@ import ( "flag" "fmt" + "github.com/sourcegraph/sourcegraph/lib/output" + "github.com/sourcegraph/src-cli/internal/batches/ui" "github.com/sourcegraph/src-cli/internal/cmderrors" - - "github.com/sourcegraph/sourcegraph/lib/output" ) func init() {