From 70fd0e0d6f80da1571040bf5b1d550384383e62d Mon Sep 17 00:00:00 2001 From: Claudio Costa Date: Wed, 10 Jul 2019 14:36:49 +0200 Subject: [PATCH] Fix mixup between stdout and stderr in CLI (#11529) --- cmd/mattermost/commands/channel.go | 2 +- cmd/mattermost/commands/export.go | 2 +- cmd/mattermost/commands/import.go | 4 ++-- cmd/mattermost/commands/output.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/mattermost/commands/channel.go b/cmd/mattermost/commands/channel.go index ea2531a4f1..bb0f5b6886 100644 --- a/cmd/mattermost/commands/channel.go +++ b/cmd/mattermost/commands/channel.go @@ -456,7 +456,7 @@ func listChannelsCmdF(command *cobra.Command, args []string) error { if channel.Type == model.CHANNEL_PRIVATE { output += " (private)" } - CommandPrintErrorln(output) + CommandPrettyPrintln(output) } } } diff --git a/cmd/mattermost/commands/export.go b/cmd/mattermost/commands/export.go index fd4b37a1fe..6f8a5ddd67 100644 --- a/cmd/mattermost/commands/export.go +++ b/cmd/mattermost/commands/export.go @@ -198,7 +198,7 @@ func bulkExportCmdF(command *cobra.Command, args []string) error { // args[0] points to the filename/filepath passed with export bulk command if err := a.BulkExport(fileWriter, args[0], pathToEmojiDir, dirNameToExportEmoji); err != nil { - CommandPrettyPrintln(err.Error()) + CommandPrintErrorln(err.Error()) return err } diff --git a/cmd/mattermost/commands/import.go b/cmd/mattermost/commands/import.go index d376fd61e4..27779921c2 100644 --- a/cmd/mattermost/commands/import.go +++ b/cmd/mattermost/commands/import.go @@ -138,9 +138,9 @@ func bulkImportCmdF(command *cobra.Command, args []string) error { CommandPrettyPrintln("") if err, lineNumber := a.BulkImport(fileReader, !apply, workers); err != nil { - CommandPrettyPrintln(err.Error()) + CommandPrintErrorln(err.Error()) if lineNumber != 0 { - CommandPrettyPrintln(fmt.Sprintf("Error occurred on data file line %v", lineNumber)) + CommandPrintErrorln(fmt.Sprintf("Error occurred on data file line %v", lineNumber)) } return err } diff --git a/cmd/mattermost/commands/output.go b/cmd/mattermost/commands/output.go index e4182b4368..f9a4bf483b 100644 --- a/cmd/mattermost/commands/output.go +++ b/cmd/mattermost/commands/output.go @@ -17,5 +17,5 @@ func CommandPrintErrorln(a ...interface{}) (int, error) { } func CommandPrettyPrintln(a ...interface{}) (int, error) { - return fmt.Fprintln(os.Stderr, a...) + return fmt.Fprintln(os.Stdout, a...) }