From 697c662a48c87ee9be136358129c1f79f4f5a72f Mon Sep 17 00:00:00 2001 From: "Anderson A. Giacomolli" Date: Fri, 6 Nov 2026 23:53:53 -0300 Subject: [PATCH] Exit with status 0 when a signal stops the daemon A signal is the normal stop of the daemon and of the terminal client, so both exit with status 0 and print no error after Ctrl-C or SIGTERM. The other commands still report a canceled context, because a signal there stops an operation before it is done. Issue: 5daf23e --- main.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 680c58d..9bc69d1 100644 --- a/main.go +++ b/main.go @@ -33,16 +33,12 @@ func run() error { if err != nil { return err } + // A signal is the normal stop of the daemon and the client, so their + // result does not include ctx.Err(). case len(args) == 1 && args[0] == "daemon": - err := daemon(ctx, os.Stdout) - if err != nil { - return err - } + return daemon(ctx, os.Stdout) case len(args) == 1 && args[0] == "chat": - err := chat(ctx, os.Stdin, os.Stdout) - if err != nil { - return err - } + return chat(ctx, os.Stdin, os.Stdout) case len(args) > 0 && args[0] == "probe": err := probe(ctx, args[1:], os.Stdout) if err != nil { -- 2.53.0