Re: [PATCH 1/3] Use Popen instead of check_output (#706099)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 18, 2011 at 09:53:24AM +0200, Martin Gracik wrote:
> subprocess.check_output was introduced in python 2.7, in rhel
> we have python 2.6, so we need to use subprocess.Popen.
> ---
>  command-stubs/list-harddrives-test |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/command-stubs/list-harddrives-test b/command-stubs/list-harddrives-test
> index 6c70a0f..92964e7 100644
> --- a/command-stubs/list-harddrives-test
> +++ b/command-stubs/list-harddrives-test
> @@ -25,13 +25,12 @@ import parted
>  
>  
>  def list_harddrives_test():
> -    try:
> -        output = check_output(['list-harddrives'])
> -    except CalledProcessError:
> +    proc = subprocess.Popen(['list-harddrives'], stdout=subprocess.PIPE)
> +    if proc.wait() != 0:
>          print('list-harddrives: list harddrives test failed')
>          sys.exit(1)
>  
> -    output = output.splitlines()
> +    output = proc.stdout.read().splitlines()
>  
>      devices = set()
>      for dev in parted.getAllDevices():
> -- 
> 1.7.3.2

Ack to all 3 of these.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)

Attachment: pgpbTBpM1JIwN.pgp
Description: PGP signature

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux