diff --git a/cmd/vspd/signal.go b/cmd/vspd/signal.go index 42ff1a2..851810a 100644 --- a/cmd/vspd/signal.go +++ b/cmd/vspd/signal.go @@ -13,8 +13,8 @@ import ( "github.com/decred/slog" ) -// interruptSignals defines the signals that are handled to do a clean shutdown. -// Conditional compilation is used to also include SIGTERM and SIGHUP on Unix. +// interruptSignals defines the default signals to catch in order to do a proper +// shutdown. This may be modified during init depending on the platform. var interruptSignals = []os.Signal{os.Interrupt} // shutdownListener listens for OS Signals such as SIGINT (Ctrl+C) and shutdown diff --git a/cmd/vspd/signal_syscall.go b/cmd/vspd/signal_syscall.go new file mode 100644 index 0000000..c40d3ba --- /dev/null +++ b/cmd/vspd/signal_syscall.go @@ -0,0 +1,16 @@ +// Copyright (c) 2016 The btcsuite developers +// Copyright (c) 2021-2023 The Decred developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +//go:build windows || aix || android || darwin || dragonfly || freebsd || hurd || illumos || ios || linux || netbsd || openbsd || solaris + +package main + +import ( + "syscall" +) + +func init() { + interruptSignals = append(interruptSignals, syscall.SIGTERM, syscall.SIGHUP) +} diff --git a/cmd/vspd/signal_unix.go b/cmd/vspd/signal_unix.go deleted file mode 100644 index ab9ceaa..0000000 --- a/cmd/vspd/signal_unix.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2016 The btcsuite developers -// Copyright (c) 2021-2022 The Decred developers -// Use of this source code is governed by an ISC -// license that can be found in the LICENSE file. - -//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris - -package main - -import ( - "os" - "syscall" -) - -func init() { - interruptSignals = []os.Signal{ - os.Interrupt, - syscall.SIGTERM, - syscall.SIGHUP, - } -}