瀏覽代碼

genrandconfig: use subprocess.check_output instead of Popen

Popen is more complicated and more difficult to understand.

check_output raises an exception if the exit code is non-zero, but
that's probably what we want if ldd can't be executed.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Arnout Vandecappelle 8 年之前
父節點
當前提交
59419cdac1
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      utils/genrandconfig

+ 1 - 1
utils/genrandconfig

@@ -184,7 +184,7 @@ def is_toolchain_usable(**kwargs):
         if 'BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y\n' in configlines or \
         if 'BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y\n' in configlines or \
            'BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64=y\n' in configlines or \
            'BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64=y\n' in configlines or \
            'BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB=y\n' in configlines:
            'BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB=y\n' in configlines:
-            ldd_version_output = subprocess.Popen(['ldd', '--version'], stdout=subprocess.PIPE).communicate()[0]
+            ldd_version_output = subprocess.check_output(['ldd', '--version'])
             glibc_version = ldd_version_output.splitlines()[0].split()[-1]
             glibc_version = ldd_version_output.splitlines()[0].split()[-1]
             if StrictVersion('2.14') > StrictVersion(glibc_version):
             if StrictVersion('2.14') > StrictVersion(glibc_version):
                 log_write(log, "WARN: ignoring the Linaro ARM toolchains becausee too old host glibc")
                 log_write(log, "WARN: ignoring the Linaro ARM toolchains becausee too old host glibc")