fix runtime panic

This commit is contained in:
Asim Aslam 2019-10-31 22:30:21 +00:00
parent fb76755684
commit 967d7ecda7

View File

@ -113,7 +113,7 @@ func (s *service) Start() error {
s.closed = make(chan bool) s.closed = make(chan bool)
// TODO: pull source & build binary // TODO: pull source & build binary
log.Debugf("Runtime service %s forking new process\n") log.Debugf("Runtime service %s forking new process\n", s.Service.Name)
p, err := s.Process.Fork(s.Exec) p, err := s.Process.Fork(s.Exec)
if err != nil { if err != nil {
return err return err
@ -144,6 +144,9 @@ func (s *service) Stop() error {
default: default:
close(s.closed) close(s.closed)
s.running = false s.running = false
if s.PID == nil {
return nil
}
return s.Process.Kill(s.PID) return s.Process.Kill(s.PID)
} }