OrmaosDocs

For agents

Exit codes for agents

What the exit code of ormaos run and of a reading verb tells an agent, and where the reason is.

View as Markdown

ormaos run returns the command's code#

ormaos run -- <command> exits with the exit code of the command, whatever was or was not recorded. An agent can put ormaos run -- in front of a command without changing how it checks the result.

exit-codesexit 3
$ 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

A command ended by a signal gives 128 plus the signal number, as a shell reports it:

exit-codesexit 143
$ 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

The recording is then (incomplete), and not collected says which process may miss its last events.

When the command cannot be started, ormaos run exits with 127 (not found) or 126 (not runnable), and nothing is recorded:

exit-codesexit 127
$ ormaos run -- no-such-program
ormaos: cannot start 'no-such-program' (FileNotFoundError)

A reading verb: 0, 1 or 2#

CodeMeaning
0it answered
1the question has no answer: no such recording or address, nothing recorded there, a recording that cannot be read
2the command line was not understood

The reason is on stderr, or in the JSON document with --json.

exit-codesexit 1
$ ormaos path r1
ormaos: no path in r1: lines are recorded only inside a scope given when recording
ormaos: next: ormaos run --path ok.py -- python ok.py

An option is written in full: --lim is not --limit.

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

The full table, with every case, is in Exit codes.