Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Sverdlov <[email protected]>
  • Loading branch information
sverdlov93 committed Aug 20, 2023
1 parent cc245a2 commit 0d4f499
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions build/utils/npm.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,14 @@ func appendScopes(oldScopes []string, newScopes []string) []string {

func RunNpmCmd(executablePath, srcPath string, npmArgs []string, log utils.Log) (stdResult, errResult []byte, err error) {
log.Debug("Running npm " + npmArgs[0] + " command.")
tmpArgs := make([]string, 0)
args := make([]string, 0)
for i := 0; i < len(npmArgs); i++ {
if strings.TrimSpace(npmArgs[i]) != "" {
tmpArgs = append(tmpArgs, npmArgs[i])
args = append(args, npmArgs[i])
}
}

command := exec.Command(executablePath, tmpArgs...)
command := exec.Command(executablePath, args...)
command.Dir = srcPath
outBuffer := bytes.NewBuffer([]byte{})
command.Stdout = outBuffer
Expand All @@ -371,11 +371,10 @@ func RunNpmCmd(executablePath, srcPath string, npmArgs []string, log utils.Log)
errResult = errBuffer.Bytes()
stdResult = outBuffer.Bytes()
if err != nil {
err = fmt.Errorf("error while running '%s %s': %s\n%s", executablePath, strings.Join(tmpArgs, " "), strings.TrimSpace(string(errResult)), err.Error())
err = fmt.Errorf("error while running '%s %s': %s\n%s", executablePath, strings.Join(args, " "), strings.TrimSpace(string(errResult)), err.Error())
return
}
// The npm command is the first element in tmpArgs array.
log.Debug("npm " + tmpArgs[0] + " standard output is:\n" + strings.TrimSpace(string(stdResult)))
log.Debug("npm '" + strings.Join(args, " ") + "' standard output is:\n" + strings.TrimSpace(string(stdResult)))
return
}

Expand Down

0 comments on commit 0d4f499

Please sign in to comment.