diff mbox series

[1/1] mbox: Exit with error code if no messages were found

Message ID 20211118120514.277328-2-n.schier@avm.de (mailing list archive)
State New, archived
Headers show
Series mbox: Exit with error code if no messages were found | expand

Commit Message

Nicolas Schier Nov. 18, 2021, 12:05 p.m. UTC
When mbox.main() is unable to retrieve any messages, there happened some
kind of error (e.g. msgid has not been found).  Forward error state to
the parent process by exiting with an error code, to allows proper
handling, e.g. in shell command concatenations.

Signed-off-by: Nicolas Schier <n.schier@avm.de>
---
 b4/mbox.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/b4/mbox.py b/b4/mbox.py
index 05d46b5..d67e456 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -722,7 +722,7 @@  def main(cmdargs):
 
     msgid, msgs = get_msgs(cmdargs)
     if not msgs:
-        return
+        sys.exit(1)
 
     if len(msgs) and cmdargs.checknewer:
         msgs = get_extra_series(msgs, direction=1, useproject=cmdargs.useproject)