fix: use golang.org/x/sys/execabs (#224)

Closes https://github.com/ooni/probe-engine/issues/1195
This commit is contained in:
Simone Basso 2021-02-10 07:40:48 +01:00 committed by GitHub
commit 18ca6d5f35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 20 deletions

View file

@ -7,9 +7,10 @@ import (
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
"golang.org/x/sys/execabs"
)
func fatalOnError(err error) {
@ -70,7 +71,7 @@ func main() {
options = append(options, *entry.Input)
}
log.Printf("run: go %s", strings.Join(options, " "))
cmd := exec.Command("go", options...)
cmd := execabs.Command("go", options...)
cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
err = cmd.Run()
fatalOnError(err)