diff --git a/pkg/adaptation/plugin.go b/pkg/adaptation/plugin.go index c4be402e..9b2a487e 100644 --- a/pkg/adaptation/plugin.go +++ b/pkg/adaptation/plugin.go @@ -119,7 +119,7 @@ func (r *Adaptation) newLaunchedPlugin(dir, idx, base, cfg string) (p *plugin, r cmd := exec.Command(filepath.Join(dir, name)) cmd.ExtraFiles = []*os.File{peerFile} cmd.Env = []string{ - api.PluginNameEnvVar + "=" + name, + api.PluginNameEnvVar + "=" + base, api.PluginIdxEnvVar + "=" + idx, api.PluginSocketEnvVar + "=3", } diff --git a/pkg/stub/stub.go b/pkg/stub/stub.go index 47009865..836b0536 100644 --- a/pkg/stub/stub.go +++ b/pkg/stub/stub.go @@ -290,7 +290,7 @@ func New(p interface{}, opts ...Option) (Stub, error) { return nil, err } - if err := stub.getIdentity(); err != nil { + if err := stub.ensureIdentity(); err != nil { return nil, err } @@ -678,8 +678,8 @@ func (stub *stub) StateChange(ctx context.Context, evt *api.StateChangeEvent) (* return &api.StateChangeResponse{}, err } -// getIdentity gets plugin index and name from the binary if those are unset. -func (stub *stub) getIdentity() error { +// ensureIdentity sets plugin index and name from the binary if those are unset. +func (stub *stub) ensureIdentity() error { if stub.idx != "" && stub.name != "" { return nil }