exit

public func exit(Int32)

Terminates the calling process immediately with the given exit code.

Wraps libc::exit. Runs atexit handlers and flushes stdio buffers; does not unwind Kestrel's stack or run deinits on values still in scope. Conventionally 0 means success and any non-zero value means failure; a few codes have specific meanings (2 is shells' "misuse of builtins", 126/127 are exec errors, >128 typically encodes a fatal signal).

Examples

exit(0); // success — does not return

Defined in lang/std/os/proc.ks