From 54a2ff2ba86b0eda1187f1f84082cc4800040a70 Mon Sep 17 00:00:00 2001 From: datalore Date: Tue, 5 Aug 2025 18:40:55 +0200 Subject: [PATCH] feat(main): Now running until receiving ctrl+c --- .gitignore | 1 + main.go | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..da67a3e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/midi-hid diff --git a/main.go b/main.go index 402ce0e..a993714 100644 --- a/main.go +++ b/main.go @@ -2,7 +2,8 @@ package main import ( "log" - "time" + "os" + "os/signal" "gitlab.com/gomidi/midi/v2" ) @@ -23,5 +24,8 @@ func main() { controllerList := must(config.Construct()) defer controllerList.Stop() - time.Sleep(time.Second * 20) + // wait for SIGINT + sigintChan := make(chan os.Signal, 1) + signal.Notify(sigintChan, os.Interrupt) + <-sigintChan }