Skip to content

Commit

Permalink
fix: memory leak (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly authored Sep 13, 2024
1 parent a5ac72b commit ef193b1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/core/runner/output_capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,14 @@ func (s *OutputCaptureRunner) CaptureOutput(cmd *exec.Cmd) error {
timeout = 5 * time.Second
}

timer := time.NewTimer(timeout)
go func() {
<-timer.C
timer := time.AfterFunc(timeout, func() {
if cmd != nil && cmd.Process != nil {
// write the error
s.WriteError([]byte("error: timeout\n"))
// send a signal to the process
cmd.Process.Kill()
}
}()
})

// create a pipe for the stdout
stdout_reader, err := cmd.StdoutPipe()
Expand Down

0 comments on commit ef193b1

Please sign in to comment.