1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-10-30 23:57:50 +02:00

fix(mta): add os.Environ() only once to command (#1260)

* add os.Environ() only once

* correct imports
This commit is contained in:
Christopher Fenner
2020-03-11 15:15:00 +01:00
committed by GitHub
parent 2021c8215a
commit 922a1796e0

View File

@@ -4,6 +4,12 @@ import (
"bytes"
"encoding/json"
"fmt"
"os"
"path"
"strings"
"text/template"
"time"
"github.com/SAP/jenkins-library/pkg/command"
piperhttp "github.com/SAP/jenkins-library/pkg/http"
"github.com/SAP/jenkins-library/pkg/log"
@@ -11,10 +17,6 @@ import (
"github.com/SAP/jenkins-library/pkg/piperutils"
"github.com/SAP/jenkins-library/pkg/telemetry"
"gopkg.in/yaml.v2"
"os"
"strings"
"text/template"
"time"
)
const templateMtaYml = `_schema-version: "3.1"
@@ -192,12 +194,13 @@ func getMarJarName(config mtaBuildOptions) string {
}
func addNpmBinToPath(e execRunner) error {
path := "./node_modules/.bin"
dir, _ := os.Getwd()
newPath := path.Join(dir, "node_modules", ".bin")
oldPath := os.Getenv("PATH")
if len(oldPath) > 0 {
path = path + ":" + oldPath
newPath = newPath + ":" + oldPath
}
e.SetEnv(append(os.Environ(), "PATH="+path))
e.SetEnv([]string{"PATH=" + newPath})
return nil
}