Skip to content

Commit

Permalink
Use the appropiate stream for the client output
Browse files Browse the repository at this point in the history
  • Loading branch information
ALEX11BR committed Dec 26, 2021
1 parent 7ef585b commit 874a1bd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 874a1bd

Please sign in to comment.