Replace "PATHEXT" literals with a constant

This commit is contained in:
Kurtis Rader 2020-08-14 21:55:50 -07:00 committed by Qi Xiao
parent b2c7746bf6
commit b9d515dd78
2 changed files with 11 additions and 8 deletions

View File

@ -80,10 +80,9 @@ func TestMakeHasCommand(t *testing.T) {
oldPath := os.Getenv(util.EnvPATH)
defer os.Setenv(util.EnvPATH, oldPath)
if runtime.GOOS == "windows" {
oldPathExt := os.Getenv("PATHEXT")
defer os.Setenv("PATHEXT", oldPathExt)
// Forces default value
os.Setenv("PATHEXT", "")
oldPathExt := os.Getenv(util.EnvPATHEXT)
defer os.Setenv(util.EnvPATHEXT, oldPathExt)
os.Unsetenv(util.EnvPATHEXT) // force default value
}
// Set up a directory in PATH.

View File

@ -2,9 +2,13 @@
package util
// Environment variables with special significance to Elvish.
//
// Note that some of these env vars may be significant only in special
// circumstances; such as when running unit tests.
const (
EnvHOME = "HOME"
EnvPATH = "PATH"
EnvPWD = "PWD"
EnvSHLVL = "SHLVL"
EnvHOME = "HOME"
EnvPATH = "PATH"
EnvPATHEXT = "PATHEXT"
EnvPWD = "PWD"
EnvSHLVL = "SHLVL"
)