From 5a3f80559c160f586a565c04aa29f29d1d24907b Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Mon, 13 Oct 2014 12:47:55 -0700 Subject: [PATCH] helper/ssh: Cleanups --- helper/ssh/communicator.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/helper/ssh/communicator.go b/helper/ssh/communicator.go index f82c56d2c..186fd4824 100644 --- a/helper/ssh/communicator.go +++ b/helper/ssh/communicator.go @@ -3,7 +3,6 @@ package ssh import ( "bufio" "bytes" - "code.google.com/p/go.crypto/ssh" "errors" "fmt" "io" @@ -14,6 +13,8 @@ import ( "path/filepath" "sync" "time" + + "code.google.com/p/go.crypto/ssh" ) // RemoteCmd represents a remote command being prepared or run. @@ -145,11 +146,6 @@ func (c *SSHCommunicator) Start(cmd *RemoteCmd) (err error) { return } - // A channel to keep track of our done state - doneCh := make(chan struct{}) - sessionLock := new(sync.Mutex) - timedOut := false - // Start a goroutine to wait for the session to end and set the // exit boolean and status. go func() { @@ -164,17 +160,8 @@ func (c *SSHCommunicator) Start(cmd *RemoteCmd) (err error) { } } - sessionLock.Lock() - defer sessionLock.Unlock() - - if timedOut { - // We timed out, so set the exit status to -1 - exitStatus = -1 - } - log.Printf("remote command exited with '%d': %s", exitStatus, cmd.Command) cmd.SetExited(exitStatus) - close(doneCh) }() return