func (p *Process) Stop() error {
	p.Lock()
	if !p.running {
		p.Unlock()
		return nil
	}
	p.forceStop = true
	if err := p.cmd.Process.Kill(); err != nil {
		return errors.Wrap(err, "kill process")
	}
	p.Unlock()
	<-p.stop
	return nil
}
Stop kill the running process.
package exec
import (
	"os"
	"os/exec"
	"sync"
	"time"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)
type Process struct {
	Path string
	Args []string
	Output string
	sync.Mutex
	running   bool
	pid       int
	cmd       *exec.Cmd
	stop      chan struct{}
	file      *os.File
	forceStop bool
}