From f20a41472b0d99999a4b6fc379307acc9cef61c3 Mon Sep 17 00:00:00 2001 From: laodouya Date: Mon, 27 May 2019 17:06:32 +0800 Subject: [PATCH] Fix data race in terminal.go --- terminal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal.go b/terminal.go index 962b875..a761205 100644 --- a/terminal.go +++ b/terminal.go @@ -35,6 +35,7 @@ func NewTerminal(cfg *Config) (*Terminal, error) { sizeChan: make(chan string, 1), } + t.wg.Add(1) go t.ioloop() return t, nil } @@ -110,7 +111,6 @@ func (t *Terminal) KickRead() { } func (t *Terminal) ioloop() { - t.wg.Add(1) defer func() { t.wg.Done() close(t.outchan)