From 9f3b054c6360239457c2adb36e04c0fa77765fcc Mon Sep 17 00:00:00 2001 From: Chris Mague Date: Wed, 26 Sep 2018 09:41:55 -0700 Subject: [PATCH] close file --- plugin.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugin.go b/plugin.go index a4ab5a3..4e091e7 100644 --- a/plugin.go +++ b/plugin.go @@ -189,8 +189,15 @@ func (p Plugin) Exec() error { "error": err, }).Fatal("Failed to execute a command") } - f, _ := os.Create(c.Ofile) + f, outferr := os.Create(c.Ofile) + if outferr != nil { + logrus.WithFields(logrus.Fields{ + "command": strings.Join(c.Tfcmd.Args, " "), + "error": outferr, + }).Fatal("Failed to write file") + } f.Write(out) + f.Close() } }