-
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathmain.go
More file actions
27 lines (24 loc) · 519 Bytes
/
main.go
File metadata and controls
27 lines (24 loc) · 519 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"OpenLinkHub/src/controller"
"os"
"os/signal"
"syscall"
)
// waitForExit listens for a program termination and switches the device back to hardware mode
func waitForExit() {
terminateSignals := make(chan os.Signal, 1)
signal.Notify(terminateSignals, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM)
for {
select {
case <-terminateSignals:
controller.Stop() // Back to hardware mode
os.Exit(0)
}
}
}
// main entry point
func main() {
go waitForExit()
controller.Start()
}