diff options
author | Thomas Voss <mail@thomasvoss.com> | 2025-06-14 01:29:40 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2025-06-14 01:29:40 +0200 |
commit | 5a12e3e229e112e6b316c9ee9f762e36f321271d (patch) | |
tree | 7222853ee2a008643e079e7f32d24edfcef2227a | |
parent | 940fe703931f0aa97f68593340d0925af19187ee (diff) |
-rw-r--r-- | main.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -6,6 +6,7 @@ package main import ( "flag" "os" + "os/signal" "path/filepath" "syscall" @@ -39,6 +40,14 @@ func main() { "database name or ‘:memory:’ for an in-memory database") flag.Parse() + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + go func() { + <-sigs + atexit.Exec() + os.Exit(0) + }() + if *debugp { path := Try2(os.Executable()) go watch.File(path, func() { |