Lyricdev
GitHub

LYR-SEM0210

an exit code outside 0 to 255

warning · spec 14-cli · lint exit-code-range, group correctness, warn unless said

fn main(): int returns an integer literal below 0 or above 255; the process leaves with it modulo 256.

Explanation

An exit code is a byte: the system keeps the value modulo 256, so return 256 leaves as 0 — success — and return -1 as 255.

Return a code from 0 to 255; 0 says success, 1 an ordinary failure.

Wrong

fn main(): int {
    return 300;
}
fn main(): int {
    return 1;
}