Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit bee156f

Browse files
committed
close sdtin stream on EOF to propagate exec process' stdin
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 41d5eb4 commit bee156f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/compose/exec.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (s *composeService) Exec(ctx context.Context, project *types.Project, opts
7272
if err != nil {
7373
return 0, err
7474
}
75-
defer resp.Close()
75+
defer resp.Close() //nolint:errcheck
7676

7777
if opts.Tty {
7878
s.monitorTTySize(ctx, exec.ID, s.apiClient.ContainerExecResize)
@@ -118,11 +118,13 @@ func (s *composeService) interactiveExec(ctx context.Context, opts api.RunOption
118118
_, err := stdcopy.StdCopy(opts.Stdout, opts.Stderr, stdout)
119119
outputDone <- err
120120
}
121+
defer stdout.Close() //nolint:errcheck
121122
}()
122123

123124
go func() {
124125
_, err := io.Copy(stdin, r)
125126
inputDone <- err
127+
defer stdin.Close() //nolint:errcheck
126128
}()
127129

128130
for {

0 commit comments

Comments
 (0)