mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Gracefully stops on SIGTERM
This commit is contained in:
parent
4ab5356ff9
commit
9ab7cab19e
@ -223,7 +223,7 @@ func makeShutdownCh() <-chan struct{} {
|
||||
resultCh := make(chan struct{})
|
||||
|
||||
signalCh := make(chan os.Signal, 4)
|
||||
signal.Notify(signalCh, os.Interrupt)
|
||||
signal.Notify(signalCh, interruptSignals...)
|
||||
go func() {
|
||||
for {
|
||||
<-signalCh
|
||||
|
10
signal_unix.go
Normal file
10
signal_unix.go
Normal file
@ -0,0 +1,10 @@
|
||||
// +build !windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var interruptSignals []os.Signal = []os.Signal{os.Interrupt, syscall.SIGTERM}
|
9
signal_windows.go
Normal file
9
signal_windows.go
Normal file
@ -0,0 +1,9 @@
|
||||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
var interruptSignals []os.Signal = []os.Signal{os.Interrupt}
|
Loading…
Reference in New Issue
Block a user