mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
drop potentially empty initial frames during exec attach
This commit is contained in:
parent
b8c38d09ef
commit
d187e8c623
@ -22,11 +22,11 @@ func NewDocker(client *api.Client, id string) *Docker {
|
||||
|
||||
// Do not allow to close reader (i.e. /dev/stdin which docker client tries to close after command execution)
|
||||
type noClosableReader struct {
|
||||
wrappedReader io.Reader
|
||||
io.Reader
|
||||
}
|
||||
|
||||
func (w *noClosableReader) Read(p []byte) (n int, err error) {
|
||||
return w.wrappedReader.Read(p)
|
||||
return w.Reader.Read(p)
|
||||
}
|
||||
|
||||
const (
|
||||
@ -35,9 +35,7 @@ const (
|
||||
STDERR = 2
|
||||
)
|
||||
|
||||
var (
|
||||
wrongFrameFormat = errors.New("Wrong frame format")
|
||||
)
|
||||
var wrongFrameFormat = errors.New("Wrong frame format")
|
||||
|
||||
// A frame has a Header and a Payload
|
||||
// Header: [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
|
||||
@ -54,6 +52,11 @@ type frameWriter struct {
|
||||
}
|
||||
|
||||
func (w *frameWriter) Write(p []byte) (n int, err error) {
|
||||
// drop initial empty frames
|
||||
if len(p) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
if len(p) > 8 {
|
||||
var targetWriter io.Writer
|
||||
switch p[0] {
|
||||
|
Loading…
Reference in New Issue
Block a user