diff mbox series

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

Message ID 20220825064109.550092-1-n.schier@avm.de (mailing list archive)
State Accepted
Headers show
Series [b4] mbox: Exit with error code if no messages were found | expand

Commit Message

Nicolas Schier Aug. 25, 2022, 6:41 a.m. UTC
When mbox.main() is unable to retrieve any messages, some kind of error
happend (e.g. msgid has not been found).  Forward error state to the
parent process by exiting with exit code 1, to allow proper
handling.

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

Comments

Nicolas Schier Oct. 17, 2022, 2:02 p.m. UTC | #1
On Thu, Aug 25, 2022 at 08:41:09AM +0200, Nicolas Schier wrote:
> When mbox.main() is unable to retrieve any messages, some kind of error
> happend (e.g. msgid has not been found).  Forward error state to the
> parent process by exiting with exit code 1, to allow proper
> handling.
> 
> 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 9a6ea9c..0d258da 100644
> --- a/b4/mbox.py
> +++ b/b4/mbox.py
> @@ -755,7 +755,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.37.2

ping.  Any feedback?
Konstantin Ryabitsev Oct. 18, 2022, 2:23 p.m. UTC | #2
On Mon, Oct 17, 2022 at 04:02:36PM +0200, Nicolas Schier wrote:
> On Thu, Aug 25, 2022 at 08:41:09AM +0200, Nicolas Schier wrote:
> > When mbox.main() is unable to retrieve any messages, some kind of error
> > happend (e.g. msgid has not been found).  Forward error state to the
> > parent process by exiting with exit code 1, to allow proper
> > handling.
> > 
> > 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 9a6ea9c..0d258da 100644
> > --- a/b4/mbox.py
> > +++ b/b4/mbox.py
> > @@ -755,7 +755,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.37.2
> 
> ping.  Any feedback?

Yes, the feedback is that I clearly need my own patchwork project. :) I've set
one up now, so I'm less likely to miss incoming patches. Thank you for your
patience.

-K
Konstantin Ryabitsev Oct. 18, 2022, 2:49 p.m. UTC | #3
On Thu, 25 Aug 2022 08:41:09 +0200, Nicolas Schier wrote:
> When mbox.main() is unable to retrieve any messages, some kind of error
> happend (e.g. msgid has not been found).  Forward error state to the
> parent process by exiting with exit code 1, to allow proper
> handling.
> 
> 

Applied, thanks!

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

Best regards,
diff mbox series

Patch

diff --git a/b4/mbox.py b/b4/mbox.py
index 9a6ea9c..0d258da 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -755,7 +755,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)