use windows Exec on windows
This commit is contained in:
parent
822a1431bb
commit
17de630616
3
main.go
3
main.go
|
@ -15,7 +15,6 @@ import (
|
|||
"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.
|
||||
|
@ -148,7 +147,7 @@ func main() {
|
|||
cmark, lookErr = exec.LookPath("markdown")
|
||||
checkError(lookErr, "finding markdown binary")
|
||||
}
|
||||
execErr := unix.Exec(cmark, []string{cmark, f.Name()}, []string{})
|
||||
execErr := localExec(cmark, []string{cmark, f.Name()}, []string{})
|
||||
checkError(execErr, "executing markdown binary")
|
||||
if err := f.Close(); err != nil {
|
||||
checkError(err, "closing file")
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
//+build !windows
|
||||
|
||||
package main
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func localExec(argv0 string, argv []string, envv []string) error {
|
||||
return unix.Exec(argv0, argv, envv)
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
//+build windows
|
||||
|
||||
package main
|
||||
|
||||
import "golang.org/x/sys/windows"
|
||||
|
||||
func localExec(argv0 string, argv []string, envv []string) error {
|
||||
return windows.Exec(argv0, argv, envv)
|
||||
}
|
Loading…
Reference in New Issue