Skip to content

Commit

Permalink
clair: add platform-specific signals
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Jul 23, 2024
1 parent 8e1a7bd commit ba6fc37
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/clair/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func main() {
auto.PrintLogs(ctx)

// Signal handler, for orderly shutdown.
sig, stop := signal.NotifyContext(ctx, os.Interrupt)
sig, stop := signal.NotifyContext(ctx, append(platformShutdown, os.Interrupt)...)
defer stop()
zlog.Info(ctx).Msg("registered signal handler")
go func() {
Expand Down
7 changes: 7 additions & 0 deletions cmd/clair/os_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build !unix

package main

import "os"

var platformShutdown = []os.Signal{}
10 changes: 10 additions & 0 deletions cmd/clair/os_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build unix

package main

import (
"os"
"syscall"
)

var platformShutdown = []os.Signal{syscall.SIGTERM}

0 comments on commit ba6fc37

Please sign in to comment.