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) <noreply@anthropic.com>
This commit is contained in:
1 parent
188545cece
commit
4e22f29a74
1 file changed
+6
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user