Refactor exec plugin load to error if plugin isn't executable

This commit is contained in:
Dominykas Djacenko
2019-10-20 17:07:04 -07:00
parent 9f8faa7d7e
commit a4784ee5ec
3 changed files with 29 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ package loader
import (
"fmt"
"os"
"path/filepath"
"plugin"
"reflect"
@@ -145,10 +146,13 @@ func (l *Loader) makeBuiltinPlugin(r resid.Gvk) (resmap.Configurable, error) {
}
func (l *Loader) loadPlugin(resId resid.ResId) (resmap.Configurable, error) {
p := execplugin.NewExecPlugin(l.absolutePluginPath(resId))
if p.IsAvailable() {
p, err := execplugin.NewExecPlugin(l.absolutePluginPath(resId))
if err == nil {
return p, nil
}
if err != nil && !os.IsNotExist(err) {
return nil, err
}
c, err := l.loadGoPlugin(resId)
if err != nil {
return nil, err