close sdtin stream on EOF to propagate exec process' stdin

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-07-02 16:32:15 +02:00
parent 41d5eb45b1
commit bee156fb97
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
1 changed files with 3 additions and 1 deletions

View File

@ -72,7 +72,7 @@ func (s *composeService) Exec(ctx context.Context, project *types.Project, opts
if err != nil {
return 0, err
}
defer resp.Close()
defer resp.Close() //nolint:errcheck
if opts.Tty {
s.monitorTTySize(ctx, exec.ID, s.apiClient.ContainerExecResize)
@ -118,11 +118,13 @@ func (s *composeService) interactiveExec(ctx context.Context, opts api.RunOption
_, err := stdcopy.StdCopy(opts.Stdout, opts.Stderr, stdout)
outputDone <- err
}
defer stdout.Close() //nolint:errcheck
}()
go func() {
_, err := io.Copy(stdin, r)
inputDone <- err
defer stdin.Close() //nolint:errcheck
}()
for {