Merge pull request #8815 from resios/resios/issue8811

Compose exec cannot process more than 32KB of data
This commit is contained in:
Mathieu Champlon 2021-10-21 06:01:59 +02:00 committed by GitHub
commit 27f5b8536b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -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
}

View File

@ -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)