# Exit codes

> The exit codes of ormaos run and of the reading verbs, each with a real run that produced it.

| Command | Code | When |
|---|---|---|
| `ormaos run -- <command>` | the command's own | always, whatever was or was not recorded (for example `0`, or `3` below) |
| | 128 plus the signal number | the command was ended by a signal, as a shell reports it (`143` for signal 15) |
| | `127` | the command was not found |
| | `126` | the command could not be started |
| | `2` | the options of `ormaos run` were not understood; the command did not run |
| a reading verb, `guide` | `0` | it answered |
| | `1` | the question has no answer: no such recording or address, nothing recorded there, a recording that cannot be read, a file that cannot be written (`guide --write`) |
| | `2` | the command line was not understood |

With `--json`, the reason of a `1` or a `2` is a JSON document of kind `error` on stdout; without it, the reason is on stderr.

## `ormaos run`

```console
$ ormaos run -- python ok.py
done
ormaos: r1 exit 0 in …: 1 Python process, 1 call, 0 exceptions
ormaos: saved in .ormaos/r1, next: ormaos tree r1:c1
```

```console
$ ormaos run -- python three.py
ormaos: r2 exit 3 in …: 1 Python process, 1 call, 1 exception (0 swallowed)
ormaos: saved in .ormaos/r2, next: ormaos tree r2:c1
# exit code 3
```

```console
$ ormaos run -- python term.py
ormaos: r3 (incomplete) exit 143 (signal 15) in …: 1 Python process, 1 call, 0 exceptions
ormaos: not collected: the last events of process …: it was ended by the program (process 1) with signal 15 before it had written everything: what it wrote is here, the calls that had not returned are marked open, and up to 256 records or what happened in its last 0.2 seconds can be missing
ormaos: saved in .ormaos/r3, next: ormaos tree r3:c1
# exit code 143
```

```console
$ ormaos run -- no-such-program
ormaos: cannot start 'no-such-program' (FileNotFoundError)
# exit code 127
```

```console
$ ormaos run -- ./not-executable
ormaos: cannot start './not-executable' (PermissionError)
# exit code 126
```

```console
$ ormaos run
usage: ormaos [-h] [--version] <verb> ...
ormaos: error: run needs a command: ormaos run -- <command> [args...]
# exit code 2
```

## Reading verbs

```console
$ ormaos show r1
r1 exit 0 in …: 1 Python process, 1 call, 0 exceptions (0 swallowed, 0 uncaught)
command: python ok.py
code: git commit not read (the working directory is not inside a git repository)
never recorded: values, and 20 more kinds of things (`ormaos show --full` lists them with the reason)
next: ormaos tree r1:c1
```

```console
$ ormaos show r9
ormaos: no recording 'r9' in .ormaos (there: r1..r5)
ormaos: next: ormaos run -- <command>
# exit code 1
```

```console
$ ormaos tree r1:c999
ormaos: no call r1:c999 in r1 (there: r1:c1..r1:c1)
ormaos: next: ormaos show r1
# exit code 1
```

```console
$ ormaos tree --limit 0
usage: ormaos tree [-h] [--json] [--limit N] [--offset N] [--depth N]
                   [--file GLOB] [--function NAME]
                   [address]
ormaos tree: error: argument --limit: must be 1 or more
# exit code 2
```

```console
$ ormaos tree --lim 5
usage: ormaos [-h] [--version] <verb> ...
ormaos: error: unrecognized arguments: --lim
# exit code 2
```

---

Source: https://docs.ormaos.com/python/reference/exit-codes/ · ormaos 0.0.1 · ormaos-python 968f69776c · ormaos-examples 6e27be5922
