Skip to content

Commit

Permalink
refactor: fix callRst on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed May 19, 2024
1 parent 87a5db3 commit cafee06
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions internal/lint/rst.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"os/exec"
"regexp"
"runtime"
"strings"

"github.com/errata-ai/vale/v3/internal/core"
Expand Down Expand Up @@ -60,17 +59,10 @@ func (l *Linter) lintRST(f *core.File) error {
return l.lintHTMLTokens(f, []byte(html), 0)
}

func callRst(text, lib, exe string) (string, error) {
func callRst(text, lib, _ string) (string, error) {
var out bytes.Buffer
var cmd *exec.Cmd

if strings.HasPrefix(runtime.GOOS, "windows") {
// rst2html is executable by default on Windows.
cmd = exec.Command(exe, append([]string{lib}, rstArgs...)...) //nolint:gosec
} else {
cmd = exec.Command(lib, rstArgs...)
}

cmd := exec.Command(lib, rstArgs...)
cmd.Stdin = strings.NewReader(text)
cmd.Stdout = &out

Expand Down

0 comments on commit cafee06

Please sign in to comment.