add system env when plugin run ()

Co-authored-by: root <root@localhost.localdomain>
This commit is contained in:
wjkxiaowu 2021-06-15 11:13:51 +08:00 committed by GitHub
parent 62dd006d50
commit f770b3cf14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions
src/modules/agentd/sys/plugins

View File

@ -21,6 +21,7 @@ import (
"os/exec"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/didi/nightingale/v4/src/common/dataobj"
@ -93,6 +94,7 @@ func PluginRun(plugin *Plugin) {
logger.Errorf("plugin:%+v %v", plugin, err)
return
}
cmd.Env = syscall.Environ()
for k, v := range envs {
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", k, v))
}