Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Patrick Ohly <patrick.ohly@intel.com>
To: "Aníbal Limón" <anibal.limon@linux.intel.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/2] oeqa/selftest/{context, case}: Add signal handlers SIG{INT, TERM}
Date: Tue, 27 Jun 2017 08:53:45 +0200	[thread overview]
Message-ID: <1498546425.7464.16.camel@intel.com> (raw)
In-Reply-To: <20170626204241.16149-1-anibal.limon@linux.intel.com>

On Mon, 2017-06-26 at 15:42 -0500, Aníbal Limón wrote:
>      def run(self, logger, args):
>          self._process_args(logger, args)
> +
> +        signal.signal(signal.SIGTERM, self._signal_clean_handler)
> +        signal.signal(signal.SIGINT, self._signal_clean_handler)
> +
>          rc = None
>  
>          if args.machine:
> @@ -220,6 +264,8 @@ class
> OESelftestTestContextExecutor(OETestContextExecutor):
>              os.remove(output_link)
>          os.symlink(args.output_log, output_link)
>  
> +        self._signal_clean_handler(None, None)
> +

Can't you achieve the same thing with less code by using a
   try:
      ... modify configuration ...
      ... run tests ...
   finally:
      ... clean up ...
block in run()?

Then you are also guaranteed to clean up if an unexpected exception
triggers the aborting of run().

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.





  parent reply	other threads:[~2017-06-27  6:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26 20:42 [PATCH 1/2] oeqa/selftest/{context, case}: Add signal handlers SIG{INT, TERM} Aníbal Limón
2017-06-26 20:42 ` [PATCH 2/2] selftest/cases/package: Call parent setUpClass method Aníbal Limón
2017-06-27  6:53 ` Patrick Ohly [this message]
2017-06-27 15:41   ` [PATCH 1/2] oeqa/selftest/{context, case}: Add signal handlers SIG{INT, TERM} Aníbal Limón

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=1498546425.7464.16.camel@intel.com \
    --to=patrick.ohly@intel.com \
    --cc=anibal.limon@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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