Skip to content

Commit

Permalink
feat(main): adding capacity of signals kill the program
Browse files Browse the repository at this point in the history
  • Loading branch information
KitsuneSemCalda committed Jan 27, 2024
1 parent 22c2190 commit 0c12126
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,26 @@ import (
tui "animatic-v2/Tui"
utils "animatic-v2/Utils"
"os"
"os/signal"
"path/filepath"
"runtime"
"syscall"
)

func main() {
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGTERM, syscall.SIGKILL)

go func() {
sig := <-sigs
switch sig {
case syscall.SIGTERM:
os.Exit(0)
case syscall.SIGKILL:
os.Exit(1)
}
}()

// If hasn't internet connection, break the program
if network.HasNetwork() == false {
message.ErrorMessage("Hasn't internet connection")
Expand Down

0 comments on commit 0c12126

Please sign in to comment.