diff --git a/main.go b/main.go index 7bc0b5e..70a5492 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "log" "mayhem-party/src" "os/signal" "syscall" @@ -13,4 +14,5 @@ func main() { if err := src.Main(ctx); err != nil && ctx.Err() == nil { panic(err) } + log.Printf("shutdown") } diff --git a/src/device/output/output.go b/src/device/output/output.go index e18ccf3..00cb1ac 100644 --- a/src/device/output/output.go +++ b/src/device/output/output.go @@ -11,5 +11,8 @@ type Output interface { } func New() Output { + if os.Getenv("OUTPUT_KEYBOARD") == "true" { + return NewKeyboard() + } return NewWriter(os.Stderr) } diff --git a/src/main.go b/src/main.go index 99c2ca9..9aa498e 100644 --- a/src/main.go +++ b/src/main.go @@ -12,6 +12,8 @@ import ( func Main(ctx context.Context) error { reader := input.New() writer := output.New() + defer writer.Close() + interval := time.Millisecond * 50 if intervalS, ok := os.LookupEnv("MAIN_INTERVAL_DURATION"); !ok { } else if v, err := time.ParseDuration(intervalS); err != nil {