From 85ef72585dd48f73e9f0c755204f0a696f1206df Mon Sep 17 00:00:00 2001 From: Andreas Resios Date: Wed, 20 Oct 2021 15:47:17 +0000 Subject: [PATCH] Compose exec cannot process more than 32KB of data Fixes #8811 Signed-off-by: Andreas Resios --- pkg/compose/exec.go | 2 +- pkg/compose/run.go | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/compose/exec.go b/pkg/compose/exec.go index 6bd4b608f..961589b01 100644 --- a/pkg/compose/exec.go +++ b/pkg/compose/exec.go @@ -90,7 +90,7 @@ func (s *composeService) interactiveExec(ctx context.Context, opts api.RunOption stdout := ContainerStdout{HijackedResponse: resp} stdin := ContainerStdin{HijackedResponse: resp} - r, err := s.getEscapeKeyProxy(opts.Stdin) + r, err := s.getEscapeKeyProxy(opts.Stdin, opts.Tty) if err != nil { return err } diff --git a/pkg/compose/run.go b/pkg/compose/run.go index 4ad8bf2f9..542e20d35 100644 --- a/pkg/compose/run.go +++ b/pkg/compose/run.go @@ -51,7 +51,7 @@ func (s *composeService) RunOneOffContainer(ctx context.Context, project *types. } func (s *composeService) runInteractive(ctx context.Context, containerID string, opts api.RunOptions) (int, error) { - r, err := s.getEscapeKeyProxy(opts.Stdin) + r, err := s.getEscapeKeyProxy(opts.Stdin, opts.Tty) if err != nil { return 0, err } @@ -179,7 +179,10 @@ func (s *composeService) prepareRun(ctx context.Context, project *types.Project, return containerID, nil } -func (s *composeService) getEscapeKeyProxy(r io.ReadCloser) (io.ReadCloser, error) { +func (s *composeService) getEscapeKeyProxy(r io.ReadCloser, isTty bool) (io.ReadCloser, error) { + if isTty { + return r, nil + } var escapeKeys = []byte{16, 17} if s.configFile.DetachKeys != "" { customEscapeKeys, err := term.ToBytes(s.configFile.DetachKeys)