diff --git a/internal/imports/imports_linux.go b/internal/imports/imports_linux.go index f52ddc8..4260247 100644 --- a/internal/imports/imports_linux.go +++ b/internal/imports/imports_linux.go @@ -25,7 +25,6 @@ import ( _ "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" _ "github.com/networkservicemesh/sdk/pkg/tools/nsurl" _ "github.com/networkservicemesh/sdk/pkg/tools/opentracing" - _ "github.com/networkservicemesh/sdk/pkg/tools/signalctx" _ "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt" _ "github.com/networkservicemesh/sdk/pkg/tools/token" _ "github.com/pkg/errors" @@ -38,6 +37,8 @@ import ( _ "google.golang.org/grpc/credentials" _ "net/url" _ "os" + _ "os/signal" + _ "syscall" _ "testing" _ "time" ) diff --git a/main.go b/main.go index 2c79828..84b979e 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,8 @@ import ( "context" "fmt" "os" + "os/signal" + "syscall" nested "github.com/antonfisher/nested-logrus-formatter" "github.com/edwarnicke/grpcfd" @@ -51,7 +53,6 @@ import ( "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" "github.com/networkservicemesh/sdk/pkg/tools/nsurl" "github.com/networkservicemesh/sdk/pkg/tools/opentracing" - "github.com/networkservicemesh/sdk/pkg/tools/signalctx" "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt" "github.com/networkservicemesh/sdk/pkg/tools/token" @@ -62,9 +63,14 @@ func main() { // ******************************************************************************** // Configure signal handling context // ******************************************************************************** - ctx := signalctx.WithSignals(context.Background()) - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) + ctx, cancel := signal.NotifyContext( + context.Background(), + os.Interrupt, + // More Linux signals here + syscall.SIGHUP, + syscall.SIGTERM, + syscall.SIGQUIT, + ) defer cancel() // ********************************************************************************