From c1c0d8d672323d4f83d19db4ea0e0bd26dba1d32 Mon Sep 17 00:00:00 2001 From: Sven van Ginkel Date: Wed, 24 Sep 2025 21:13:24 +0200 Subject: [PATCH] Fix hub executable (#1193) --- internal/hub/update.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/hub/update.go b/internal/hub/update.go index cf16ff17..3495e974 100644 --- a/internal/hub/update.go +++ b/internal/hub/update.go @@ -22,6 +22,12 @@ func Update(cmd *cobra.Command, _ []string) { // Check if china-mirrors flag is set useMirror, _ := cmd.Flags().GetBool("china-mirrors") + // Get the executable path before update + exePath, err := os.Executable() + if err != nil { + log.Fatal(err) + } + updated, err := ghupdate.Update(ghupdate.Config{ ArchiveExecutable: "beszel", DataDir: dataDir, @@ -35,11 +41,8 @@ func Update(cmd *cobra.Command, _ []string) { } // make sure the file is executable - exePath, err := os.Executable() - if err == nil { - if err := os.Chmod(exePath, 0755); err != nil { - fmt.Printf("Warning: failed to set executable permissions: %v\n", err) - } + if err := os.Chmod(exePath, 0755); err != nil { + fmt.Printf("Warning: failed to set executable permissions: %v\n", err) } // Try to restart the service if it's running