From 48259078df97f8efe7d1d0da464d6dbe5479336d Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Mon, 1 Apr 2019 12:53:37 -0400 Subject: [PATCH] avoid opening files just to close them --- drivers/shared/executor/executor.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/shared/executor/executor.go b/drivers/shared/executor/executor.go index 070e101d5..2bd32dc48 100644 --- a/drivers/shared/executor/executor.go +++ b/drivers/shared/executor/executor.go @@ -177,13 +177,11 @@ func (c *ExecCommand) Stderr() (io.WriteCloser, error) { } func (c *ExecCommand) Close() { - stdout, err := c.Stdout() - if err == nil { - stdout.Close() + if c.stdout != nil { + c.stdout.Close() } - stderr, err := c.Stderr() - if err == nil { - stderr.Close() + if c.stderr != nil { + c.stderr.Close() } }