From ada8a8c6d3e4094eb7971c1371a93a00e9ac60c5 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 9 Mar 2023 13:19:45 -0500 Subject: [PATCH] fix(output): set default tty before querying the terminal --- output.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/output.go b/output.go index 9708f4c..e22d369 100644 --- a/output.go +++ b/output.go @@ -8,7 +8,7 @@ import ( var ( // output is the default global output. - output = NewOutput(nil) + output = NewOutput(os.Stdout) ) // File represents a file descriptor. @@ -73,15 +73,15 @@ func NewOutput(tty io.Writer, opts ...OutputOption) *Output { bgColor: NoColor{}, } + if o.tty == nil { + o.tty = os.Stdout + } for _, opt := range opts { opt(o) } if o.Profile < 0 { o.Profile = o.EnvColorProfile() } - if o.tty == nil { - o.tty = os.Stdout - } return o }