Skip to content

Commit 253dbaa

Browse files
committed
fix(attach): set terminal size only if it is present
Signed-off-by: Lorenzo Fontana <[email protected]>
1 parent 36c62da commit 253dbaa

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

pkg/attacher/attach.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ func (a *Attacher) AttachJob(traceJobID types.UID, namespace string) {
5454
func (a *Attacher) Attach(selector, namespace string) {
5555
go wait.ExponentialBackoff(wait.Backoff{
5656
Duration: time.Second * 1,
57-
Factor: 2,
58-
Jitter: 0,
59-
Steps: 10,
57+
Factor: 0.01,
58+
Jitter: 0.0,
59+
Steps: 100,
6060
}, func() (bool, error) {
6161
pl, err := a.CoreV1Client.Pods(namespace).List(metav1.ListOptions{
6262
LabelSelector: selector,
@@ -133,11 +133,14 @@ func (a attach) defaultAttachFunc() func() error {
133133
// since the TTY is always in raw mode when attaching do a fake resize
134134
// of the screen so that it will be redrawn during attach and detach
135135
tsize := a.tty.GetSize()
136-
tsizeinc := *tsize
137-
tsizeinc.Height++
138-
tsizeinc.Width++
136+
var terminalSizeQueue remotecommand.TerminalSizeQueue
137+
if tsize != nil {
138+
tsizeinc := *tsize
139+
tsizeinc.Height++
140+
tsizeinc.Width++
141+
terminalSizeQueue = a.tty.MonitorSize(&tsizeinc, tsize)
142+
}
139143

140-
terminalSizeQueue := a.tty.MonitorSize(&tsizeinc, tsize)
141144
return att.Attach("POST", req.URL(), a.config, a.tty.In, a.tty.Out, nil, a.tty.Raw, terminalSizeQueue)
142145
}
143146
}

pkg/cmd/delete.go

+3
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ func (o *DeleteOptions) Complete(factory factory.Factory, cmd *cobra.Command, ar
125125
return err
126126
}
127127

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

0 commit comments

Comments
 (0)