mirror of
https://github.com/docker/compose.git
synced 2026-08-31 23:03:55 +00:00
set terminal in character mode when attached to a container
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
9f81314124
commit
d4a8e92f46
5 changed files with 44 additions and 14 deletions
|
|
@ -62,7 +62,7 @@ func (a *allowListLogConsumer) Register(name string) {
|
|||
}
|
||||
|
||||
// GetWriter creates a io.Writer that will actually split by line and format by LogConsumer
|
||||
func GetWriter(container, service string, events compose.ContainerEventListener) io.Writer {
|
||||
func GetWriter(container, service string, events compose.ContainerEventListener) io.WriteCloser {
|
||||
return &splitBuffer{
|
||||
buffer: bytes.Buffer{},
|
||||
service: service,
|
||||
|
|
@ -100,3 +100,17 @@ func (s *splitBuffer) Write(b []byte) (int, error) {
|
|||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (s *splitBuffer) Close() error {
|
||||
b := s.buffer.Bytes()
|
||||
if len(b) == 0 {
|
||||
return nil
|
||||
}
|
||||
s.consumer(compose.ContainerEvent{
|
||||
Type: compose.ContainerEventLog,
|
||||
Service: s.service,
|
||||
Container: s.container,
|
||||
Line: string(b),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue