use unix.Exec instead of syscall.Exec
This commit is contained in:
parent
5b9795d676
commit
e86e26c4bc
8
main.go
8
main.go
|
@ -10,12 +10,12 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/alecthomas/chroma"
|
"github.com/alecthomas/chroma"
|
||||||
"github.com/alecthomas/chroma/formatters/html"
|
"github.com/alecthomas/chroma/formatters/html"
|
||||||
"github.com/alecthomas/chroma/lexers"
|
"github.com/alecthomas/chroma/lexers"
|
||||||
"github.com/alecthomas/chroma/styles"
|
"github.com/alecthomas/chroma/styles"
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
// dataPipedIn returns true if the user piped data via stdin.
|
// dataPipedIn returns true if the user piped data via stdin.
|
||||||
|
@ -132,7 +132,6 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkError(bs.Err(), "reading markdown file")
|
checkError(bs.Err(), "reading markdown file")
|
||||||
_ = needCSS
|
|
||||||
f, err := ioutil.TempFile("", "chroma-markdown-")
|
f, err := ioutil.TempFile("", "chroma-markdown-")
|
||||||
checkError(err, "creating temporary file")
|
checkError(err, "creating temporary file")
|
||||||
w := bufio.NewWriter(f)
|
w := bufio.NewWriter(f)
|
||||||
|
@ -149,6 +148,9 @@ func main() {
|
||||||
cmark, lookErr = exec.LookPath("markdown")
|
cmark, lookErr = exec.LookPath("markdown")
|
||||||
checkError(lookErr, "finding markdown binary")
|
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")
|
checkError(execErr, "executing markdown binary")
|
||||||
|
if err := f.Close(); err != nil {
|
||||||
|
checkError(err, "closing file")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue