Skip to content

Commit

Permalink
Merge pull request #48 from moul/fix-43
Browse files Browse the repository at this point in the history
Exiting connection when exiting shell (Fix #43)
  • Loading branch information
moul committed Oct 8, 2015
2 parents 598a9fc + dab6d9b commit bbc5e28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ all: build
build: $(notdir $(COMMANDS))

run: build
./ssh2docker
./ssh2docker -V

$(notdir $(COMMANDS)): $(SOURCES)
go get -t ./...
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ GLOBAL OPTIONS:

### master (unreleased)

* No entry
* Kill connection when exiting shell (ctrl+D) ([#43](https://github.com/moul/ssh2docker/issues/43))

[full commits list](https://github.com/moul/ssh2docker/compare/v1.1.0...master)

Expand Down
7 changes: 7 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ func (c *Client) HandleChannelRequests(channel ssh.Channel, requests <-chan *ssh
once.Do(close)
}()

go func() {
if err := cmd.Wait(); err != nil {
logrus.Warnf("cmd.Wait failed: %v", err)
}
once.Do(close)
}()

case "pty-req":
ok = true
termLen := req.Payload[3]
Expand Down

0 comments on commit bbc5e28

Please sign in to comment.