Support exec plugin on Windows

This commit is contained in:
June Yi
2020-09-22 22:42:18 +09:00
parent 537ff024dd
commit 551841b789

View File

@@ -9,6 +9,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"runtime"
"strings"
"github.com/google/shlex"
@@ -50,7 +51,9 @@ func (p *ExecPlugin) ErrIfNotExecutable() error {
if err != nil {
return err
}
if f.Mode()&0111 == 0000 {
// In Windows, it is not possible to determine whether a
// file is executable through file mode.
if f.Mode()&0111 == 0000 && runtime.GOOS != "windows" {
return fmt.Errorf("unexecutable plugin at: %s", p.path)
}
return nil