added osutils.IsProbablyGoRun

This commit is contained in:
Gani Georgiev
2025-09-06 18:14:20 +03:00
parent a088cf6379
commit 40f2ba731c
6 changed files with 60 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/hook"
"github.com/pocketbase/pocketbase/tools/list"
"github.com/pocketbase/pocketbase/tools/osutils"
"github.com/pocketbase/pocketbase/tools/routine"
"github.com/spf13/cobra"
@@ -293,7 +294,7 @@ func (pb *PocketBase) skipBootstrap() bool {
// note: we are using os.Args[0] and not os.Executable() since it could
// break existing aliased binaries (eg. the community maintained homebrew package)
func inspectRuntime() (baseDir string, withGoRun bool) {
if strings.HasPrefix(os.Args[0], os.TempDir()) {
if osutils.IsProbablyGoRun() {
// probably ran with go run
withGoRun = true
baseDir, _ = os.Getwd()