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

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



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


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