MCPcopy Index your code
hub / github.com/codebench-dev/worker / installSignalHandlers

Function installSignalHandlers

main.go:115–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113}
114
115func installSignalHandlers() {
116 go func() {
117 // Clear some default handlers installed by the firecracker SDK:
118 signal.Reset(os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
119 c := make(chan os.Signal, 1)
120 signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
121
122 for {
123 switch s := <-c; {
124 case s == syscall.SIGTERM || s == os.Interrupt:
125 log.Printf("Caught signal: %s, requesting clean shutdown", s.String())
126 deleteVMMSockets()
127 os.Exit(0)
128 case s == syscall.SIGQUIT:
129 log.Printf("Caught signal: %s, forcing shutdown", s.String())
130 deleteVMMSockets()
131 os.Exit(0)
132 }
133 }
134 }()
135}

Callers 1

mainFunction · 0.85

Calls 1

deleteVMMSocketsFunction · 0.85

Tested by

no test coverage detected