From 9ef16c1bf2bfc1e00163b461779383c809efff9f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 3 Mar 2025 03:45:36 -0600 Subject: better tree init() --- stdoutShow.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'stdoutShow.go') diff --git a/stdoutShow.go b/stdoutShow.go index 68ec55b..4bbf59a 100644 --- a/stdoutShow.go +++ b/stdoutShow.go @@ -161,14 +161,19 @@ func (w stdout) Write(p []byte) (n int, err error) { lines := strings.Split(strings.TrimSpace(string(p)), "\n") me.stdout.outputS = append(me.stdout.outputS, lines...) - fmt.Fprint(outf, string(p)) + if me.outf != nil { + fmt.Fprint(me.outf, string(p)) + } return len(p), nil } func (w *guiWidget) Write(p []byte) (n int, err error) { lines := strings.Split(strings.TrimSpace(string(p)), "\n") - fmt.Fprint(outf, string(p)) + if me.outf != nil { + fmt.Fprint(me.outf, string(p)) + } + if w == nil { me.stdout.outputS = append(me.stdout.outputS, lines...) return len(p), nil @@ -187,7 +192,6 @@ func (w *guiWidget) Write(p []byte) (n int, err error) { // redo this old code v, _ := me.baseGui.View("msg") if v != nil { - // fmt.Fprintln(outf, "found msg") tk.v = v } return len(p), nil -- cgit v1.2.3