Skip to content

Commit 57d950d

Browse files
committed
fix: possible goroutine leak in exec
If timeout happens and ShouldWait is false (default) cmd.Wait() goroutine will stack forever on sending to done channel. The will be no receiver from done. Making the channel buffered lets the goroutine exit. Signed-off-by: Anton Tiurin <[email protected]>
1 parent 86df781 commit 57d950d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exec/exec.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func RunCommandExt(cmd *exec.Cmd, opts CmdOpts) (string, error) {
111111
return "", err
112112
}
113113

114-
done := make(chan error)
114+
done := make(chan error, 1)
115115
go func() { done <- cmd.Wait() }()
116116

117117
// Start a timer

0 commit comments

Comments
 (0)