🚦 Exit Codes
✅ Check mode (--check)
--check suppresses stdout and uses the truthiness of the transform result as the exit code.
| Exit code | Meaning |
|---|---|
| 0 | ✅ Result is truthy |
| 1 | ❌ Result is falsy |
Truthiness table
| Value | Truthy? |
|---|---|
null |
❌ falsy |
false |
❌ falsy |
0, 0.0 |
❌ falsy |
"" |
❌ falsy |
[], {} |
❌ falsy |
| Everything else | ✅ truthy |
# ✅ Validate a record
fimod s -i record.json -e 'data.get("email") and data.get("name")' --check
# 🔀 In a shell conditional
if fimod s -i config.json -m validate.py --check; then
echo "✅ Config is valid"
else
echo "❌ Config has errors" >&2
exit 1
fi
🚦 set_exit(code)
set_exit(code) sets the process exit code from inside a mold:
codeis an integer 0–255- The mold continues executing to completion after the call
- Returns
None
🔀 Interaction between set_exit and --check
set_exit takes priority
When both are active, set_exit overrides --check for the exit code. Stdout is still suppressed by --check.
# set_exit(2) inside validate.py overrides --check truthiness
fimod s -i record.json -m validate.py --check
echo $? # could be 2, not 0 or 1