From 3f3b77dcd43cf497a53e248ce32296bff1380115 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Tue, 24 Jun 2025 08:49:21 +0300 Subject: [PATCH] print go run in the superuser create installer suggestion if temp dir location is detected --- apis/installer.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apis/installer.go b/apis/installer.go index 03467f44..b94c599b 100644 --- a/apis/installer.go +++ b/apis/installer.go @@ -32,7 +32,7 @@ func DefaultInstallerFunc(app core.App, systemSuperuser *core.Record, baseURL st _ = osutils.LaunchURL(url) color.Magenta("\n(!) Launch the URL below in the browser if it hasn't been open already to create your first superuser account:") color.New(color.Bold).Add(color.FgCyan).Println(url) - color.New(color.FgHiBlack, color.Italic).Printf("(you can also create your first superuser by running: %s superuser upsert EMAIL PASS)\n\n", os.Args[0]) + color.New(color.FgHiBlack, color.Italic).Printf("(you can also create your first superuser by running: %s superuser upsert EMAIL PASS)\n\n", executablePath()) return nil } @@ -86,3 +86,12 @@ func findOrCreateInstallerSuperuser(app core.App) (*core.Record, error) { return record, nil } + +func executablePath() string { + // most likely ran with go run + if strings.HasPrefix(os.Args[0], os.TempDir()) { + return "go run ." + } + + return os.Args[0] +}