MCPcopy Index your code
hub / github.com/coder/coder / resolveWorkDir

Method resolveWorkDir

agent/agentproc/process.go:371–386  ·  view source on GitHub ↗

resolveWorkDir returns the directory a process should start in. Priority: explicit request dir > agent configured dir > $HOME. Falls through when a candidate is empty or does not exist on disk, matching the behavior of SSH sessions.

(requested string)

Source from the content-addressed store, hash-verified

369// Falls through when a candidate is empty or does not exist on
370// disk, matching the behavior of SSH sessions.
371func (m *manager) resolveWorkDir(requested string) string {
372 if requested != "" {
373 return requested
374 }
375 if m.workingDir != nil {
376 if dir := m.workingDir(); dir != "" {
377 if info, err := os.Stat(dir); err == nil && info.IsDir() {
378 return dir
379 }
380 }
381 }
382 if home, err := os.UserHomeDir(); err == nil {
383 return home
384 }
385 return ""
386}

Callers 1

startMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected