helper/ssh: Cleanups

This commit is contained in:
Armon Dadgar 2014-10-13 12:47:55 -07:00
parent d7e77202ba
commit 5a3f80559c
1 changed files with 2 additions and 15 deletions

View File

@ -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