exit

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package exit is bitc's exit-code contract (spec 4). Every bitc outcome that is not the command's own exit code is an *Error carrying its code and the exact stderr line.

Index

Constants

View Source
const (
	OK           = 0
	Usage        = 64  // EX_USAGE: fix the call
	NoInput      = 66  // EX_NOINPUT: no such job
	Unavailable  = 69  // EX_UNAVAILABLE: do not retry blindly (also internal errors)
	TempFail     = 75  // EX_TEMPFAIL: starved; wait and retry
	Config       = 78  // EX_CONFIG: fix config
	StillRunning = 124 // wait: job still running
)

Variables

This section is empty.

Functions

func Code

func Code(err error) int

Code maps an error to bitc's exit code: nil 0, *Error its code, anything else 69.

func Go

func Go(fn func())

Go starts fn in a goroutine whose panic ends bitc with 69 instead of Go's exit 2. Every goroutine in bitc is started through Go (guard_test.go enforces it).

Types

type Error

type Error struct {
	Code    int
	Line    string
	Outcome string
	Reason  string
}

Error is a bitc outcome. Line is printed verbatim to stderr (no trailing newline); Outcome and Reason go to result.json (spec 4).

func As

func As(err error) *Error

As returns the *Error inside err, or err wrapped as an internal error.

func Configf

func Configf(format string, a ...any) *Error

func Internal

func Internal(v any) *Error

Internal is a bitc bug: 69, never 75 (a bug that fails every time must not loop a retrying agent) and never Go's 2.

func LinuxOnly

func LinuxOnly(feature, goos string) *Error

LinuxOnly is the one refusal of a Linux-only feature in a non-Linux client build: 69, like "not Linux" (docs/exit-codes.md). feature takes a singular verb ("the remote agent").

func NoInputf

func NoInputf(format string, a ...any) *Error

func Refused

func Refused(pool, reason string) *Error

Refused is 64 from a refuse rule or a hook: "bitc: <pool>: refused: <reason>".

func Starved

func Starved(pool, reason string) *Error

Starved is 75: "STARVED <pool>" or "STARVED <pool> (<reason>)".

func Unavailablef

func Unavailablef(format string, a ...any) *Error

func Usagef

func Usagef(format string, a ...any) *Error

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL