Skip to content

Commit

Permalink
Improve error handling (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzerk committed Feb 27, 2017
1 parent 3fa2816 commit fce0f32
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions main.go
Expand Up @@ -157,8 +157,13 @@ func observer(
if err != nil {
log.Println(err)
}

defer func() {
recover() // 1
return
}()
// Kill the process
defer proc.Kill()
proc.Kill()
}
}
}
Expand Down Expand Up @@ -189,13 +194,18 @@ func observer(
if err != nil {
log.Println(err)
}

defer func() {
recover() // 1
return
}()
// Kill the process
defer proc.Kill()
proc.Kill()

time.Sleep(5 * time.Second)
}

// Optional (YAML file, default: false): keep this program open even if
// Optional (YAML file, default: false): keep ts program open even if
// the process is disconnected
if !config.StayAlive {
os.Exit(1)
Expand Down

0 comments on commit fce0f32

Please sign in to comment.