Skip to content

Commit

Permalink
Changes from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
kontsevoy committed Aug 23, 2016
1 parent ec880ae commit f01da3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions lib/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,17 @@ type TeleportClient struct {
Config
localAgent *LocalKeyAgent

// OnShellCreated gets called when the shell is created. It's
// safe to keep it nil
OnShellCreated ShellCreatedCallback

// ExitMsg (if set) will be printed at the end of the SSH session
ExitMsg string
}

// This callback can be supplied for every teleport client. It will be called
// right after the remote shell is created, but the session hasn't begun yet.
// ShellCreatedCallback can be supplied for every teleport client. It will
// be called right after the remote shell is created, but the session
// hasn't begun yet.
//
// It allows clients to cancel SSH action
type ShellCreatedCallback func(shell io.ReadWriteCloser) (exit bool, err error)
Expand Down Expand Up @@ -722,7 +725,7 @@ func (tc *TeleportClient) runShell(nodeClient *NodeClient, sessionID session.ID,
if tc.OnShellCreated != nil {
exit, err := tc.OnShellCreated(shell)
if exit {
return err
return trace.Wrap(err)
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (client *NodeClient) Shell(
// this goroutine sleeps until a terminal size changes (it receives an OS signal)
sigC := make(chan os.Signal, 1)
signal.Notify(sigC, syscall.SIGWINCH)
broadcastOurTerminalSize := func() {
broadcastTerminalSize := func() {
for {
select {
case sig := <-sigC:
Expand Down Expand Up @@ -376,7 +376,7 @@ func (client *NodeClient) Shell(
}

// detect changes of the session's terminal
updateOurTerminalSize := func() {
updateTerminalSize := func() {
tick := time.NewTicker(defaults.SessionRefreshPeriod)
defer tick.Stop()
var prevSess *session.Session
Expand Down Expand Up @@ -419,8 +419,8 @@ func (client *NodeClient) Shell(
}

if attachedTerm {
go broadcastOurTerminalSize()
go updateOurTerminalSize()
go broadcastTerminalSize()
go updateTerminalSize()
}

go func() {
Expand Down

0 comments on commit f01da3d

Please sign in to comment.