[Piglit] [PATCH] xz: Use --help when detecting xz presence
jordan.l.justen at intel.com
Sun Aug 2 12:32:29 PDT 2015
On 2015-08-02 09:57:00, Dylan Baker wrote:
> On Aug 2, 2015 00:45, "Jordan Justen" <jordan.l.justen at intel.com> wrote:
> > 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
> > index 88bde2a..97b0f32 100644
> > --- a/framework/backends/compression.py
> > +++ b/framework/backends/compression.py
> > @@ -95,7 +95,7 @@ try:
> > except ImportError:
> > try:
> > with open(os.devnull, 'w') as d:
> > - subprocess.check_call(['xz'], stderr=d)
> > + subprocess.check_call(['xz', '--help'], stdout=d,
> Based on you're commit message I don't think this sides what you want. I
> think you should set stderr=d to hide both stderr and stdout.
stderr=subprocess.STDOUT should send stderr to the same file as
stdout, and stdout is sent to /dev/null.
> > except subprocess.CalledProcessError as e:
> > if e.returncode == 1:
> > import contextlib
> > --
> > 2.1.4
More information about the Piglit