mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
fix: add cmd dir path to /Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-py-plugin/.venv/bin:/Users/debugtalk/Library/Python/3.9/bin:/Users/debugtalk/.poetry/bin:/usr/local/opt/node@12/bin:/Users/debugtalk/.gvm/bin:/Users/debugtalk/go/go1.16.3/bin:/Users/debugtalk/go/bin:/usr/local/sbin:/Users/debugtalk/.pyenv/bin:/Users/debugtalk/.poetry/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/puppetlabs/bin:/Users/debugtalk/Library/Python/3.9/bin:/Users/debugtalk/.poetry/bin:/usr/local/opt/node@12/bin:/Users/debugtalk/.gvm/bin:/Users/debugtalk/go/go1.16.3/bin:/Users/debugtalk/go/bin:/usr/local/sbin:/Users/debugtalk/.pyenv/bin:/Users/debugtalk/.local/bin:/Users/debugtalk/.local/bin:/Users/debugtalk/go/bin:/Users/debugtalk/.local/bin
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# NOTE: Generated By HttpRunner v4.0.0
|
||||
# NOTE: Generated By HttpRunner v4.1.3
|
||||
# FROM: request_methods/request_with_functions.yml
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +62,15 @@ func ExecCommand(cmdName string, args ...string) error {
|
||||
cmd := exec.Command(cmdName, args...)
|
||||
log.Info().Str("cmd", cmd.String()).Msg("exec command")
|
||||
|
||||
// add cmd dir path to $PATH
|
||||
if cmdDir := filepath.Dir(cmdName); cmdDir != "" {
|
||||
PATH := fmt.Sprintf("%s:%s", cmdDir, os.Getenv("PATH"))
|
||||
if err := os.Setenv("PATH", PATH); err != nil {
|
||||
log.Error().Err(err).Msg("set env $PATH failed")
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// print output with colors
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
Reference in New Issue
Block a user