From 874a1bd335607e57172f25730610c484ca71482a Mon Sep 17 00:00:00 2001 From: Popa Ioan Alexandru Date: Sun, 26 Dec 2021 05:17:07 +0200 Subject: [PATCH] Use the appropiate stream for the client output --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index bd873ee..60b7540 100644 --- a/main.go +++ b/main.go @@ -13,9 +13,17 @@ func main() { args, parser := common.ParseArgs() if parser.Subcommand() != nil { + var stream *os.File res := client.SendCommand(args) + + if res.Status == 0 { + stream = os.Stdout + } else { + stream = os.Stderr + } + if res.Message != "" { - fmt.Fprintln(os.Stderr, res.Message) + fmt.Fprintln(stream, res.Message) } os.Exit(res.Status) } else {