From 2c4de6243ae9f681ed2ae0c382845e52f59ce36a Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 1 Apr 2016 12:14:55 +0000 Subject: [PATCH] Review comment: move pty's Close --- probe/host/controls.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/probe/host/controls.go b/probe/host/controls.go index 3f666c66cc..4e67e7a551 100644 --- a/probe/host/controls.go +++ b/probe/host/controls.go @@ -37,8 +37,10 @@ func (r *Reporter) execHost(req xfer.Request) xfer.Response { } pipe.OnClose(func() { if err := cmd.Process.Kill(); err != nil { - log.Errorf("Error closing host shell: %v", err) - return + log.Errorf("Error stopping host shell: %v", err) + } + if err := ptyPipe.Close(); err != nil { + log.Errorf("Error closing host shell's pty: %v", err) } log.Info("Host shell closed.") }) @@ -46,7 +48,6 @@ func (r *Reporter) execHost(req xfer.Request) xfer.Response { if err := cmd.Wait(); err != nil { log.Errorf("Error waiting on host shell: %v", err) } - ptyPipe.Close() pipe.Close() }()