Skip to content

Commit e31c3b5

Browse files
authored
Merge pull request #2660 from nspcc-dev/handle-sigterm
cli/server: handle SIGTERM gracefully
2 parents bf06b32 + 1850c04 commit e31c3b5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

cli/server/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os"
99
"os/signal"
1010
"runtime"
11+
"syscall"
1112
"time"
1213

1314
"github.com/nspcc-dev/neo-go/cli/cmdargs"
@@ -119,6 +120,7 @@ func newGraceContext() context.Context {
119120
ctx, cancel := context.WithCancel(context.Background())
120121
stop := make(chan os.Signal, 1)
121122
signal.Notify(stop, os.Interrupt)
123+
signal.Notify(stop, syscall.SIGTERM)
122124
go func() {
123125
<-stop
124126
cancel()

0 commit comments

Comments
 (0)