mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +00:00
Add a signal handler to pause.
It returns 0 when a signal is received.
This commit is contained in:
@@ -18,9 +18,16 @@ limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
import "syscall"
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Halts execution, waiting on signal.
|
||||
syscall.Pause()
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGTERM)
|
||||
|
||||
// Block until a signal is received.
|
||||
<-c
|
||||
}
|
||||
|
Reference in New Issue
Block a user