Skip to content

Commit

Permalink
Added SIGTERM to sigintTrap
Browse files Browse the repository at this point in the history
  • Loading branch information
dszlachta committed Apr 30, 2024
1 parent 224f3bb commit f9b1c7c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/apps/chifra/pkg/sigintTrap/trap.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"os/signal"
"sync"
"syscall"

"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors"
)
Expand All @@ -20,9 +21,11 @@ type CleanupFunction func()

// Enable enables the trap, by blocking control-C. It returns
// a channel that will get a value when user presses ctrl-C.
// It also blocks SIGTERM, which is sent by Docker when user
// turns it off.
func Enable(ctx context.Context, cancel context.CancelFunc, cleanUp CleanupFunction) chan os.Signal {
signals := make(chan os.Signal, 1)
signal.Notify(signals, os.Interrupt)
signal.Notify(signals, os.Interrupt, syscall.SIGTERM)

go func() {
for {
Expand Down

0 comments on commit f9b1c7c

Please sign in to comment.