From dfcedb7069fdff355d691574ce7475063d75b3fc Mon Sep 17 00:00:00 2001 From: ouqiang Date: Wed, 12 Apr 2017 14:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgoroutine=E6=9C=AA=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ssh/ssh.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go index 08f8775..873a0ae 100644 --- a/modules/ssh/ssh.go +++ b/modules/ssh/ssh.go @@ -27,7 +27,6 @@ func Exec(sshConfig SSHConfig, cmd string) (output string, err error) { var timeoutChan chan bool = make(chan bool) go execCommand(sshConfig, cmd, resultChan) go triggerTimeout(timeoutChan, sshConfig.ExecTimeout) - select { case result := <- resultChan: output = result.Output @@ -81,5 +80,5 @@ func triggerTimeout(ch chan bool, timeout int){ timeout = 86400 } time.Sleep(time.Duration(timeout) * time.Second) - ch <- true + close(ch) } \ No newline at end of file