cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Paul Chaignon <paul@cilium.io>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Exit with non-zero status
Date: Wed, 29 Apr 2020 17:07:56 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2004291704240.2450@hadrien> (raw)
In-Reply-To: <20200429143926.GA24738@Mem>



On Wed, 29 Apr 2020, Paul Chaignon wrote:

> Hi everyone,
>
> I am trying to exit spatch with a non-zero exit status when required
> changes have been found. I have tried to add a rule with finalize:python
> and the following code:
>
>   @finalize:python@
>   @@
>   exit(cnt)
>
> where cnt is incremented by another Python rule everytime a required
> change is found. This works as expected except for the --in-place option
> which becomes ineffective.
>
> Is this a bug, or is finalize:python not intended to be used in that
> manner? Is it possible to overwrite spatch's exit status?

I'm actually surprised that this would ever work...

Finalize was intended for processing information in general, eg printing
some statistics about what was matched.

Would it be feasible to print cnt instead?

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  reply	other threads:[~2020-04-29 15:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 14:39 [Cocci] Exit with non-zero status Paul Chaignon
2020-04-29 15:07 ` Julia Lawall [this message]
2020-04-29 15:16   ` Paul Chaignon
2020-04-29 15:25     ` Julia Lawall
2020-04-29 18:40 Markus Elfring
2020-04-29 19:07 ` Paul Chaignon
2020-04-29 19:50   ` Markus Elfring
2020-05-05  9:59     ` Paul Chaignon
2020-05-05 11:08       ` Markus Elfring
2020-05-06 12:01         ` Paul Chaignon
2020-05-06 12:24           ` Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2004291704240.2450@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=paul@cilium.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).