Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit d2df9e1

Browse files
authored
fix: ensure wsep processes are closed (#436)
1 parent edf70b9 commit d2df9e1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

internal/sync/singlefile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func SingleFile(ctx context.Context, local, remoteDir string, workspace *coder.W
3939
if err != nil {
4040
return xerrors.Errorf("start sync command: %w", err)
4141
}
42+
defer process.Close()
4243

4344
sourceFile, err := os.Open(local)
4445
if err != nil {

internal/sync/sync.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ func (s Sync) remoteCmd(ctx context.Context, prog string, args ...string) error
109109
if err != nil {
110110
return xerrors.Errorf("exec remote process: %w", err)
111111
}
112+
defer process.Close()
113+
112114
// NOTE: If the copy routine fail, it will result in `process.Wait` to unblock and report an error.
113115
go func() { _, _ = io.Copy(s.OutW, process.Stdout()) }() // Best effort.
114116
go func() { _, _ = io.Copy(s.ErrW, process.Stderr()) }() // Best effort.
@@ -290,6 +292,8 @@ func (s Sync) Version() (string, error) {
290292
if err != nil {
291293
return "", err
292294
}
295+
defer process.Close()
296+
293297
buf := &bytes.Buffer{}
294298
_, _ = io.Copy(buf, process.Stdout()) // Ignore error, if any, it would be handled by the process.Wait return.
295299

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy