Skip to content

Commit 68df068

Browse files
committed
Fix send on closed channel error
1 parent 2844580 commit 68df068

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func (c *Command) Execute() error {
153153
}
154154

155155
done := make(chan error, 1)
156-
defer close(done)
157156
quit := make(chan bool, 1)
158157
defer close(quit)
159158

@@ -175,6 +174,7 @@ func (c *Command) Execute() error {
175174
c.exitCode = 0
176175
case <-timeoutChan:
177176
quit <- true
177+
close(done)
178178
if err := cmd.Process.Kill(); err != nil {
179179
return fmt.Errorf("Timeout occurred and can not kill process with pid %v", cmd.Process.Pid)
180180
}

0 commit comments

Comments
 (0)