Global code ovehaul - remove CAS and other, add 15 minute greet check
- Remove CAS, as it no longer works for us - Remove other checks - Implement 15 minute greet timeout check - Fix chat logos - Ditch thirdparty logger, use stdlib log facility wrapper for logging
This commit is contained in:
25
internal/moon/exitCode.go
Normal file
25
internal/moon/exitCode.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package moon
|
||||
|
||||
import "os"
|
||||
|
||||
// ExitCode reports the status the process should leave with on a clean return
|
||||
// from run(). It is zero while the bot is running normally, and 128 + the
|
||||
// signal's number once a termination signal has begun the shutdown — the Unix
|
||||
// convention a supervisor can use to tell "stopped with a signal" from "stopped
|
||||
// cleanly", which D33 left permanently 0 before it.
|
||||
//
|
||||
// It never reports an error status: a failed shutdown still returns an error
|
||||
// from run(), and main exits 1 over that, the same as before.
|
||||
func ExitCode() int {
|
||||
return int(exitCode.Load())
|
||||
}
|
||||
|
||||
// recordExitCode stores the status the given terminating signal should leave.
|
||||
// Only the first termination signal matters — the handler goroutine returns
|
||||
// after one — so a later write cannot pass either.
|
||||
func recordExitCode(s os.Signal) {
|
||||
// The value is one of a fixed table of 128+n, never a caller-supplied int.
|
||||
exitCode.Store(int32(exitCodeFor(s))) //nolint:gosec // G115: exitCodeFor returns only 130, 131, 143 or 0.
|
||||
}
|
||||
|
||||
/* vim: set ft=go noet ai ts=4 sw=4 sts=4: */
|
||||
Reference in New Issue
Block a user