Skip to content

Commit

Permalink
Fix exec plugins on windows
Browse files Browse the repository at this point in the history
The exec plugin implementation checks if an executable file exists but
on windows it won't check for files with .exe suffix thus falling back
to go plugin implementation
  • Loading branch information
jaysonsantos committed Nov 24, 2020
1 parent f8194bd commit 517c42a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api/internal/plugins/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"path/filepath"
"plugin"
"reflect"
"runtime"
"strings"

"github.com/pkg/errors"
Expand Down Expand Up @@ -177,7 +178,11 @@ func (l *Loader) loadPlugin(res *resource.Resource) (resmap.Configurable, error)

func (l *Loader) loadExecOrGoPlugin(resId resid.ResId) (resmap.Configurable, error) {
// First try to load the plugin as an executable.
p := execplugin.NewExecPlugin(l.absolutePluginPath(resId))
pluginPath := l.absolutePluginPath(resId)
if runtime.GOOS == "windows" {
pluginPath = fmt.Sprintf("%s.exe", pluginPath)
}
p := execplugin.NewExecPlugin(pluginPath)
err := p.ErrIfNotExecutable()
if err == nil {
return p, nil
Expand Down

0 comments on commit 517c42a

Please sign in to comment.