[OE-core] [PATCH 1/1] runqemu: remove use of subprocess.run()

Joshua Lock joshua.g.lock at linux.intel.com
Wed Sep 7 14:23:36 UTC 2016


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 at 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
> 



More information about the Openembedded-core mailing list