Skip to main content

Module bash_notes

Module bash_notes 

Source
Expand description

Result conventions of the model’s bash (wave 38, from Mirror’s tools/bash_tool.rs):

  • exit code 1 from a read-only comparison command (grep, rg, diff, cmp, test, …) reports a result, not a failure. When the command is a simple pipeline whose last command is one of those, the result carries an exit_note (“No matches found”); runtime.py then shows [No matches found (exit code 1)] instead of the failure line [exit code 1]. exit_code stays 1 (and .ok, a clean exit 0, stays false);
  • a failed command whose output shows the sandbox refused it carries a sandbox_note (sandbox::refusal), a line runtime.py prints after the output, saying what was blocked and what is allowed.

Constants§

NON_ERROR_EXIT_1
Commands whose exit code 1 reports a result, and the note shown in place of the failure line.

Functions§

annotate
Adds the notes to a bash result (output) or a job snapshot (text) of command: exit_note when the command ended with a non-error exit 1, sandbox_note when it failed and policy (the sandbox in use, if any) refused it. A result still running, stopped or without an exit code gets neither.
exit_note
The note for exit_code of command: exit code 1 of a simple pipeline (commands joined by | or |&, nothing else) whose last command is one of NON_ERROR_EXIT_1. Anything else (;, &&, ||, &, a newline, a subshell or command substitution, a ! negation) may have taken its status from another command: no note.