mirror of https://github.com/maxcnunes/gaper.git
Fix exit handler for successful exits
This commit is contained in:
parent
e4534caa82
commit
89c15bf15c
10
gaper.go
10
gaper.go
|
@ -145,17 +145,15 @@ func restart(builder Builder, runner Runner) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleProgramExit(builder Builder, runner Runner, err error, noRestartOn string) error {
|
func handleProgramExit(builder Builder, runner Runner, err error, noRestartOn string) error {
|
||||||
exiterr, ok := err.(*exec.ExitError)
|
var exitStatus int
|
||||||
if !ok {
|
if exiterr, ok := err.(*exec.ExitError); ok {
|
||||||
return fmt.Errorf("couldn't handle program crash restart: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
status, oks := exiterr.Sys().(syscall.WaitStatus)
|
status, oks := exiterr.Sys().(syscall.WaitStatus)
|
||||||
if !oks {
|
if !oks {
|
||||||
return fmt.Errorf("couldn't resolve exit status: %v", err)
|
return fmt.Errorf("couldn't resolve exit status: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
exitStatus := status.ExitStatus()
|
exitStatus = status.ExitStatus()
|
||||||
|
}
|
||||||
|
|
||||||
// if "error", an exit code of 0 will still restart.
|
// if "error", an exit code of 0 will still restart.
|
||||||
if noRestartOn == "error" && exitStatus == exitStatusError {
|
if noRestartOn == "error" && exitStatus == exitStatusError {
|
||||||
|
|
Loading…
Reference in New Issue