Skip to content

Commit

Permalink
Merge pull request #11 from jasmineamber/main
Browse files Browse the repository at this point in the history
fix: set wrong env path in windows
  • Loading branch information
debugtalk authored Aug 21, 2024
2 parents 66d9835 + 84014b6 commit c86d24e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion myexec/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"

"github.com/httprunner/funplugin/fungo"
Expand Down Expand Up @@ -162,7 +163,12 @@ func RunCommand(cmdName string, args ...string) error {

// add cmd dir path to $PATH
if cmdDir := filepath.Dir(cmdName); cmdDir != "" {
path := fmt.Sprintf("%s:%s", cmdDir, PATH)
var path string
if runtime.GOOS == "windows" {
path = fmt.Sprintf("%s;%s", cmdDir, PATH)
} else {
path = fmt.Sprintf("%s:%s", cmdDir, PATH)
}
if err := os.Setenv("PATH", path); err != nil {
logger.Error("set env $PATH failed", "error", err)
return err
Expand Down

0 comments on commit c86d24e

Please sign in to comment.