mirror of https://github.com/maxcnunes/gaper.git
parent
931f3778a8
commit
7ecf55b3f6
3
gaper.go
3
gaper.go
|
@ -103,7 +103,8 @@ func run(cfg *Config, chOSSiginal chan os.Signal, builder Builder, runner Runner
|
|||
continue
|
||||
}
|
||||
|
||||
changeRestart = true
|
||||
changeRestart = runner.IsRunning()
|
||||
|
||||
if err := restart(builder, runner); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ type Runner interface {
|
|||
Kill() error
|
||||
Errors() chan error
|
||||
Exited() bool
|
||||
IsRunning() bool
|
||||
ExitStatus(err error) int
|
||||
}
|
||||
|
||||
|
@ -108,6 +109,11 @@ func (r *runner) Exited() bool {
|
|||
return r.command != nil && r.command.ProcessState != nil && r.command.ProcessState.Exited()
|
||||
}
|
||||
|
||||
// IsRunning returns if the process is running
|
||||
func (r *runner) IsRunning() bool {
|
||||
return r.command != nil && r.command.Process != nil && r.command.Process.Pid > 0
|
||||
}
|
||||
|
||||
// Errors get errors occurred during the build
|
||||
func (r *runner) Errors() chan error {
|
||||
return r.errors
|
||||
|
|
|
@ -57,6 +57,12 @@ func (m *MockRunner) Exited() bool {
|
|||
return args.Bool(0)
|
||||
}
|
||||
|
||||
// IsRunning ...
|
||||
func (m *MockRunner) IsRunning() bool {
|
||||
args := m.Called()
|
||||
return args.Bool(0)
|
||||
}
|
||||
|
||||
// ExitStatus ...
|
||||
func (m *MockRunner) ExitStatus(err error) int {
|
||||
args := m.Called()
|
||||
|
|
Loading…
Reference in New Issue