From dd26839351ab69a585007485964d371f38990535 Mon Sep 17 00:00:00 2001 From: tidwall Date: Tue, 30 Mar 2021 08:59:25 -0700 Subject: [PATCH] Fix tile38-cli output showing protocol size when piping fixes #603 --- cmd/tile38-cli/main.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/cmd/tile38-cli/main.go b/cmd/tile38-cli/main.go index a266484a..648e7508 100644 --- a/cmd/tile38-cli/main.go +++ b/cmd/tile38-cli/main.go @@ -61,9 +61,8 @@ func showHelp() bool { } fmt.Fprintf(os.Stdout, "tile38-cli %s%s\n\n", core.Version, gitsha) fmt.Fprintf(os.Stdout, "Usage: tile38-cli [OPTIONS] [cmd [arg [arg ...]]]\n") - fmt.Fprintf(os.Stdout, " --raw Use raw formatting for replies (default when STDOUT is not a tty)\n") + fmt.Fprintf(os.Stdout, " --raw Use raw formatting for replies\n") fmt.Fprintf(os.Stdout, " --noprompt Do not display a prompt\n") - fmt.Fprintf(os.Stdout, " --tty Force TTY\n") fmt.Fprintf(os.Stdout, " --resp Use RESP output formatting (default is JSON output)\n") fmt.Fprintf(os.Stdout, " --json Use JSON output formatting (default is JSON output)\n") fmt.Fprintf(os.Stdout, " -h Server hostname (default: %s)\n", hostname) @@ -146,14 +145,6 @@ func main() { return } - if !raw && !tty && runtime.GOOS != "windows" { - fi, err := os.Stdout.Stat() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - return - } - raw = (fi.Mode() & os.ModeCharDevice) == 0 - } if len(oneCommand) > 0 && (oneCommand[0] == 'h' || oneCommand[0] == 'H') && strings.Split(strings.ToLower(oneCommand), " ")[0] == "help" { showHelp() return @@ -490,7 +481,7 @@ func help(arg string) error { } fmt.Fprintf(os.Stderr, ` "quit" to exit`+"\n") if noprompt && tty { - fmt.Fprintf(os.Stderr, groups) + fmt.Fprint(os.Stderr, groups) } return nil } @@ -512,7 +503,7 @@ func help(arg string) error { } if showGroups { if noprompt && tty { - fmt.Fprintf(os.Stderr, groups) + fmt.Fprint(os.Stderr, groups) } } else if !found { if noprompt && tty {