MCPcopy
hub / github.com/pocketbase/pocketbase / inspectRuntime

Function inspectRuntime

pocketbase.go:298–309  ·  view source on GitHub ↗

inspectRuntime tries to find the base executable directory and how it was run. note: we are using os.Args[0] and not os.Executable() since it could break existing aliased binaries (eg. the community maintained homebrew package)

()

Source from the content-addressed store, hash-verified

296// note: we are using os.Args[0] and not os.Executable() since it could
297// break existing aliased binaries (eg. the community maintained homebrew package)
298func inspectRuntime() (baseDir string, withGoRun bool) {
299 if osutils.IsProbablyGoRun() {
300 // probably ran with go run
301 withGoRun = true
302 baseDir, _ = os.Getwd()
303 } else {
304 // probably ran with go build
305 withGoRun = false
306 baseDir = filepath.Dir(os.Args[0])
307 }
308 return
309}
310
311// newErrWriter returns a red colored stderr writter.
312func newErrWriter() *coloredWriter {

Callers 2

NewFunction · 0.85
NewWithConfigFunction · 0.85

Calls 1

IsProbablyGoRunFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…