All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] mbox: Exit with error code if no messages were found
@ 2021-11-18 12:05 Nicolas Schier
  2021-11-18 12:05 ` [PATCH 1/1] " Nicolas Schier
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Schier @ 2021-11-18 12:05 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: tools, Nicolas Schier

Hi,

working with b4 on a local public-inbox installation, I stumbled across
the behaviour of 'b4 am'.  I knew a correct Message-Id and wanted to
fetch the whole patch set as soon as it reaches the public-inbox
instance.  Thus I did a stupid

  while ! b4 am MSGID; do sleep 10; done

'b4 am MSGID' showed 'That message-id is not known.' and exited with
return code 0.  As this seemed strange to me I added a 'sys.exit(0)' to
fix my use case; but this patch feels too simple to be good.

Can someone point me to some point(s) I am currently too blind to see?

Kind regards,
Nicolas


Nicolas Schier (1):
  mbox: Exit with error code if no messages were found

 b4/mbox.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] mbox: Exit with error code if no messages were found
  2021-11-18 12:05 [PATCH 0/1] mbox: Exit with error code if no messages were found Nicolas Schier
@ 2021-11-18 12:05 ` Nicolas Schier
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Schier @ 2021-11-18 12:05 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: tools, Nicolas Schier

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 --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)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-18 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 12:05 [PATCH 0/1] mbox: Exit with error code if no messages were found Nicolas Schier
2021-11-18 12:05 ` [PATCH 1/1] " Nicolas Schier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.