You've already forked sap-jenkins-library
							
							
				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:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							2021c8215a
						
					
				
				
					commit
					922a1796e0
				
			| @@ -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 | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user