MCPcopy
hub / github.com/gotify/server / WithWd

Function WithWd

test/filepath.go:18–29  ·  view source on GitHub ↗

WithWd executes a function with the specified working directory.

(chDir string, f func(origWd string))

Source from the content-addressed store, hash-verified

16
17// WithWd executes a function with the specified working directory.
18func WithWd(chDir string, f func(origWd string)) {
19 wd, err := os.Getwd()
20 if err != nil {
21 panic(err)
22 }
23
24 if err := os.Chdir(chDir); err != nil {
25 panic(err)
26 }
27 defer os.Chdir(wd)
28 f(wd)
29}

Callers 4

SetupSuiteMethod · 0.92
SetupSuiteMethod · 0.92
TestWithWdFunction · 0.85

Calls

no outgoing calls

Tested by 4

SetupSuiteMethod · 0.74
SetupSuiteMethod · 0.74
TestWithWdFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…