public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Joshua Lock <joshua.g.lock@linux.intel.com>
To: openembedded-core@openembedded.org
Subject: Re: [PATCH 1/1] runqemu: remove use of subprocess.run()
Date: Wed, 07 Sep 2016 15:23:36 +0100	[thread overview]
Message-ID: <1473258216.3063.0.camel@linux.intel.com> (raw)
In-Reply-To: <ed86c1c66b672f6b959f93155ba456f173f6f0d6.1473257282.git.joshua.g.lock@intel.com>

On Wed, 2016-09-07 at 15:10 +0100, Joshua Lock wrote:
> We aim to support Python 3.4+ whereas subprocess.run() was added
> in Python 3.5.
> Replace subprocess.run() with subprocess.check_output().
> 
> Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
> ---
>  scripts/runqemu | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/runqemu b/scripts/runqemu
> index 0a56c60..3ffd87a 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -858,10 +858,11 @@ class BaseConfig(object):
>              cmd = 'bitbake -e'
>  
>          logger.info('Running %s...' % cmd)
> -        proc = subprocess.run(cmd, shell=True,
> stdout=subprocess.PIPE)
> -        if proc.returncode != 0:
> -            logger.warn("Couldn't run 'bitbake -e' to gather
> environment information")
> -        self.bitbake_e = proc.stdout.decode('utf-8')
> +        try:
> +            out = subprocess.check_output(cmd,
> shell=True).decode('utf-8')
> +            self.bitbake_e = out
> +        except subprocess.CalledProcessError as err:
> +            logger.warn("Couldn't run 'bitbake -e' to gather
> environment information/\n%s" % out)

I'm trying to access out when it's unassigned here, v2 coming soon.

Regards,

Joshua

>  
>  def main():
>      if len(sys.argv) == 1 or "help" in sys.argv:
> -- 
> 2.7.4
> 


  reply	other threads:[~2016-09-07 14:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07 14:10 [PATCH 0/1] Python3 runqemu: remove use of subprocess.run() Joshua Lock
2016-09-07 14:10 ` [PATCH 1/1] " Joshua Lock
2016-09-07 14:23   ` Joshua Lock [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-09-07 16:09 [PATCH 0/1] Python3 " Joshua Lock
2016-09-07 16:09 ` [PATCH 1/1] " Joshua Lock

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=1473258216.3063.0.camel@linux.intel.com \
    --to=joshua.g.lock@linux.intel.com \
    --cc=openembedded-core@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