From e86e26c4bcf86f4f0d3fb1bd428ea6f7fef0fc0a Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Mon, 19 Mar 2018 09:00:14 -0700 Subject: [PATCH] use unix.Exec instead of syscall.Exec --- main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 2ab4680..1631f4a 100644 --- a/main.go +++ b/main.go @@ -10,12 +10,12 @@ import ( "os" "os/exec" "strings" - "syscall" "github.com/alecthomas/chroma" "github.com/alecthomas/chroma/formatters/html" "github.com/alecthomas/chroma/lexers" "github.com/alecthomas/chroma/styles" + "golang.org/x/sys/unix" ) // dataPipedIn returns true if the user piped data via stdin. @@ -132,7 +132,6 @@ func main() { } } checkError(bs.Err(), "reading markdown file") - _ = needCSS f, err := ioutil.TempFile("", "chroma-markdown-") checkError(err, "creating temporary file") w := bufio.NewWriter(f) @@ -149,6 +148,9 @@ func main() { cmark, lookErr = exec.LookPath("markdown") checkError(lookErr, "finding markdown binary") } - execErr := syscall.Exec(cmark, []string{cmark, f.Name()}, []string{}) + execErr := unix.Exec(cmark, []string{cmark, f.Name()}, []string{}) checkError(execErr, "executing markdown binary") + if err := f.Close(); err != nil { + checkError(err, "closing file") + } }