Skip to content

Commit

Permalink
helper/ssh: Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
armon committed Oct 13, 2014
1 parent d7e7720 commit 5a3f805
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions helper/ssh/communicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ssh
import (
"bufio"
"bytes"
"code.google.com/p/go.crypto/ssh"
"errors"
"fmt"
"io"
Expand All @@ -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.
Expand Down Expand Up @@ -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() {
Expand All @@ -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
Expand Down

0 comments on commit 5a3f805

Please sign in to comment.