feature: append path in process env util adds new env to start instead end of path entries list
parent
194898b8a0
commit
525c37d8e3
|
@ -13,13 +13,15 @@ import (
|
||||||
var PathEnvironmentVariableName = "PATH"
|
var PathEnvironmentVariableName = "PATH"
|
||||||
|
|
||||||
func AppendPath(cmd *exec.Cmd, newElements ...string) {
|
func AppendPath(cmd *exec.Cmd, newElements ...string) {
|
||||||
pathEntries := GetPath(cmd)
|
pathEntries := array_list.NewArrayList[string]()
|
||||||
for _, newPathEntry := range newElements {
|
for _, newPathEntry := range newElements {
|
||||||
if !pathEntries.Contains(newPathEntry) {
|
if !pathEntries.Contains(newPathEntry) {
|
||||||
pathEntries.Add(newPathEntry)
|
pathEntries.Add(newPathEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pathEntries.AddAll(GetPath(cmd))
|
||||||
|
|
||||||
SetPath(cmd, pathEntries.ToSliceUnsafe()...)
|
SetPath(cmd, pathEntries.ToSliceUnsafe()...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue