Skip to content

Commit 97dd637

Browse files
authored
fix: UpdatePath handle empty PATHs
Before it would add an unnecessary colon to the PATH. Signed-off-by: Ben Durrans <Benjamin.Durrans@snyk.io>
1 parent 45def04 commit 97dd637

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/envvars/environment.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ func UpdatePath(pathExtension string, prepend bool) string {
114114
return currentPath
115115
}
116116

117+
if currentPath == "" {
118+
_ = os.Setenv(PathEnvVarName, pathExtension)
119+
return pathExtension
120+
}
121+
117122
currentPathEntries := strings.Split(currentPath, string(os.PathListSeparator))
118123
addPathEntries := strings.Split(pathExtension, string(os.PathListSeparator))
119124

0 commit comments

Comments
 (0)