MCPcopy Index your code
hub / github.com/cli/safeexec / setenv

Function setenv

lookpath_test.go:145–157  ·  view source on GitHub ↗
(t *testing.T, name, newValue string)

Source from the content-addressed store, hash-verified

143}
144
145func setenv(t *testing.T, name, newValue string) {
146 oldValue, hasOldValue := os.LookupEnv(name)
147 if err := os.Setenv(name, newValue); err != nil {
148 t.Errorf("error setting environment variable %s: %v", name, err)
149 }
150 t.Cleanup(func() {
151 if hasOldValue {
152 _ = os.Setenv(name, oldValue)
153 } else {
154 _ = os.Unsetenv(name)
155 }
156 })
157}
158
159func winonly(s string) string {
160 if runtime.GOOS == "windows" {

Callers 1

TestLookPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…