Skip to content

Commit

Permalink
fix(attach): set terminal size only if it is present
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Fontana <lo@linux.com>
  • Loading branch information
fntlnz committed Nov 25, 2018
1 parent 36c62da commit 253dbaa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pkg/attacher/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ func (a *Attacher) AttachJob(traceJobID types.UID, namespace string) {
func (a *Attacher) Attach(selector, namespace string) {
go wait.ExponentialBackoff(wait.Backoff{
Duration: time.Second * 1,
Factor: 2,
Jitter: 0,
Steps: 10,
Factor: 0.01,
Jitter: 0.0,
Steps: 100,
}, func() (bool, error) {
pl, err := a.CoreV1Client.Pods(namespace).List(metav1.ListOptions{
LabelSelector: selector,
Expand Down Expand Up @@ -133,11 +133,14 @@ func (a attach) defaultAttachFunc() func() error {
// since the TTY is always in raw mode when attaching do a fake resize
// of the screen so that it will be redrawn during attach and detach
tsize := a.tty.GetSize()
tsizeinc := *tsize
tsizeinc.Height++
tsizeinc.Width++
var terminalSizeQueue remotecommand.TerminalSizeQueue
if tsize != nil {
tsizeinc := *tsize
tsizeinc.Height++
tsizeinc.Width++
terminalSizeQueue = a.tty.MonitorSize(&tsizeinc, tsize)
}

terminalSizeQueue := a.tty.MonitorSize(&tsizeinc, tsize)
return att.Attach("POST", req.URL(), a.config, a.tty.In, a.tty.Out, nil, a.tty.Raw, terminalSizeQueue)
}
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ func (o *DeleteOptions) Complete(factory factory.Factory, cmd *cobra.Command, ar
return err
}

if o.traceID == nil && o.traceName == nil && o.all == false {
return fmt.Errorf("when no trace id or trace name are specified you must specify --all=true to delete all the traces")
}
return nil
}

Expand Down

0 comments on commit 253dbaa

Please sign in to comment.