diff --git a/main.go b/main.go index 1631f4a..8bb692d 100644 --- a/main.go +++ b/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") diff --git a/main_unix.go b/main_unix.go new file mode 100644 index 0000000..80b775e --- /dev/null +++ b/main_unix.go @@ -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) +} diff --git a/main_windows.go b/main_windows.go new file mode 100644 index 0000000..380afa4 --- /dev/null +++ b/main_windows.go @@ -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) +}