Handle exit code on err
fixes #96. This change checks the err returned from the StartServer function, and if it exists, passes a non-zero error code through to the urfave/cli framework. This should allow processes like launchd to detect if cloudflared exited gracefully or with an error.
This commit is contained in:
parent
4bff1ef9df
commit
a1403fe968
|
@ -127,10 +127,14 @@ func action(version string, shutdownC, graceShutdownC chan struct{}) cli.ActionF
|
|||
tags["hostname"] = c.String("hostname")
|
||||
raven.SetTagsContext(tags)
|
||||
raven.CapturePanic(func() { err = tunnel.StartServer(c, version, shutdownC, graceShutdownC) }, nil)
|
||||
exitCode := 0
|
||||
if err != nil {
|
||||
handleError(err)
|
||||
exitCode = 1
|
||||
}
|
||||
return err
|
||||
// we already handle error printing, so we pass an empty string so we
|
||||
// don't have to print again.
|
||||
return cli.Exit("", exitCode)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue