From 4e22f29a74bbc31cd89f35d06f8623c332391a2a Mon Sep 17 00:00:00 2001 From: Jean-Pierre Martineau Date: Tue, 6 Oct 2026 23:48:50 -0400 Subject: [PATCH] The exit status docstring says what grep does It said that grep treats "found nothing" and "worked" as the same result. grep exits with 0 when it finds a line, with 1 when it finds nothing, and with 2 on an error, so it is the usual exception. The text now says so, and it says why MeshTerm uses 5: 1 is already FAILURE. Co-Authored-By: Claude Opus 5.5 (1M context) --- meshterm/core/exitcodes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/meshterm/core/exitcodes.py b/meshterm/core/exitcodes.py index b1abec1..8be69f0 100644 --- a/meshterm/core/exitcodes.py +++ b/meshterm/core/exitcodes.py @@ -39,10 +39,12 @@ causes below is :data:`FAILURE`. No part of MeshTerm makes a new code of its own +------+--------------+--------------------------------------------------------+ :data:`NO_RESULT` is the code that is most important to explain. A script wants this -code most, and no other tool gives it. For example, ``grep`` treats "found nothing" and -"worked" as the same result. A caller that must count the output lines to know an empty -mesh from a full mesh must parse the output. With this code, the caller can make a -branch on the status instead. +code most, and few tools give it. Most tools exit with 0 when they find nothing, the same +as when they find something. A caller of such a tool must count the output lines to know +an empty mesh from a full mesh, thus it must parse the output. ``grep`` is the usual +exception: it exits with 1 when it finds no line, and with 2 on an error. In MeshTerm, +1 is already :data:`FAILURE`, so "nothing to report" has a code of its own. With this +code, the caller can make a branch on the status instead. """ from __future__ import annotations