[Piglit] [PATCH] xz: Use --help when detecting xz presence

Jordan Justen jordan.l.justen at intel.com
Sun Aug 2 00:44:44 PDT 2015

If xz is present, and the piglit command's output is redirected, then
xz will think its output is redirected. This will cause xz to try to
read data from stdin to compress.

Instead we can run xz with --help to cause it to print help
information if the xz executable is present, and prevent xz from
trying to compress data from stdin.

Since we don't want to see 'xz --help' output from piglit, we now need
to redirect both stdout and stderr to /dev/null.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Cc: Dylan Baker <baker.dylan.c at gmail.com>
 framework/backends/compression.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/backends/compression.py b/framework/backends/compression.py
index 88bde2a..97b0f32 100644
--- a/framework/backends/compression.py
+++ b/framework/backends/compression.py
@@ -95,7 +95,7 @@ try:
 except ImportError:
         with open(os.devnull, 'w') as d:
-            subprocess.check_call(['xz'], stderr=d)
+            subprocess.check_call(['xz', '--help'], stdout=d, stderr=subprocess.STDOUT)
     except subprocess.CalledProcessError as e:
         if e.returncode == 1:
             import contextlib

More information about the Piglit mailing list