MCPcopy
hub / github.com/go-task/task / dirOption

Function dirOption

internal/execext/exec.go:159–178  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

157}
158
159func dirOption(path string) interp.RunnerOption {
160 return func(r *interp.Runner) error {
161 err := interp.Dir(path)(r)
162 if err == nil {
163 return nil
164 }
165
166 // If the specified directory doesn't exist, it will be created later.
167 // Therefore, even if `interp.Dir` method returns an error, the
168 // directory path should be set only when the directory cannot be found.
169 if absPath, _ := filepath.Abs(path); absPath != "" {
170 if _, err := os.Stat(absPath); os.IsNotExist(err) {
171 r.Dir = absPath
172 return nil
173 }
174 }
175
176 return err
177 }
178}

Callers 1

RunCommandFunction · 0.70

Calls 1

DirMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…