semantic-exit 1.0.0

Semantic exit codes inspired by HTTP status codes
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//go:build linux || darwin
// +build linux darwin

package exit

import "syscall"

// FromSignal returns the exit code that corresponds to when a program
// exits in response to a signal.
func FromSignal(signal syscall.Signal) Code {
	// According to https://tldp.org/LDP/abs/html/exitcodes.html, it's standard
	// for a unix process to exit with 128 + n where n is a fatal signal.
	return Code(128 + int(signal))
}