From 81ee0f1dceed6dc36c0ac800a37d33b275507cea Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Fri, 7 Feb 2020 13:55:53 +0800 Subject: [PATCH] github.com/fatih/color: patch to remove race condition... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when printing to a Pipe. When unpatched, Site: 哔哩哔哩 bilibili.com Title: ... Type: video Stream: [64] ------------------- Quality: 高清 720P Size: 91.35 MiB (95783022 Bytes) # download with: annie -f 64 ... is instead printed as Site: Title: Type: Stream: [64] ------------------- Quality: Size: # download with: 哔哩哔哩 bilibili.com ... video 高清 720P 91.35 MiB (95783022 Bytes) annie -f 64 ... --- vendor/github.com/fatih/color/color.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go index 91c8e9f..e04d377 100644 --- a/vendor/github.com/fatih/color/color.go +++ b/vendor/github.com/fatih/color/color.go @@ -204,7 +204,8 @@ func (c *Color) Print(a ...interface{}) (n int, err error) { c.Set() defer c.unset() - return fmt.Fprint(Output, a...) + return fmt.Print(a...) + // return fmt.Fprint(Output, a...) } // Fprintf formats according to a format specifier and writes to w. @@ -225,7 +226,8 @@ func (c *Color) Printf(format string, a ...interface{}) (n int, err error) { c.Set() defer c.unset() - return fmt.Fprintf(Output, format, a...) + return fmt.Printf(format, a...) + // return fmt.Fprintf(Output, format, a...) } // Fprintln formats using the default formats for its operands and writes to w. @@ -248,7 +250,8 @@ func (c *Color) Println(a ...interface{}) (n int, err error) { c.Set() defer c.unset() - return fmt.Fprintln(Output, a...) + return fmt.Println(a...) + // return fmt.Fprintln(Output, a...) } // Sprint is just like Print, but returns a string instead of printing it.