catchSignal tries to catch SIGHUP, SIGINT, SIGKILL, SIGQUIT and SIGTERM, and Interrupt for removing temporarily created config files before the program ends. Note: we cannot intercept a `kill -9`, so a well-timed `kill -9` will allow a temp config file to linger.
(sig chan os.Signal, tempConfigFileName string)
| 60 | // ends. Note: we cannot intercept a `kill -9`, so a well-timed `kill -9` |
| 61 | // will allow a temp config file to linger. |
| 62 | func catchSignal(sig chan os.Signal, tempConfigFileName string) { |
| 63 | <-sig |
| 64 | _ = os.Remove(tempConfigFileName) |
| 65 | os.Exit(2) |
| 66 | } |