From 4b11d839ec7a82e9d51582cddae8c302b44fd0fd Mon Sep 17 00:00:00 2001 From: "othman.suseno" Date: Thu, 18 Dec 2025 15:28:58 +0700 Subject: [PATCH] still fixing UI issue --- internal/zfs/service.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/zfs/service.go b/internal/zfs/service.go index c363568..22cf785 100644 --- a/internal/zfs/service.go +++ b/internal/zfs/service.go @@ -82,7 +82,7 @@ func (s *Service) execCommand(name string, args ...string) (string, error) { if err != nil && useSudo { // Log that sudo failed log.Printf("sudo command failed, trying direct execution: %s %v (error: %v, stderr: %s)", name, args, err, stderr.String()) - + // If sudo failed, try running the command directly // (user might already have permissions or be root) directCmd := exec.Command(name, args...) @@ -90,7 +90,8 @@ func (s *Service) execCommand(name string, args ...string) (string, error) { directCmd.Stdout = &directStdout directCmd.Stderr = &directStderr - if directErr := directCmd.Run(); directErr == nil { + directErr := directCmd.Run() + if directErr == nil { // Direct execution succeeded, return that result log.Printf("direct command execution succeeded (without sudo)") return strings.TrimSpace(directStdout.String()), nil @@ -231,7 +232,7 @@ func (s *Service) CreatePool(name string, vdevs []string, options map[string]str } args = append(args, name) - + // Normalize vdev paths - ensure they start with /dev/ if they don't already normalizedVdevs := make([]string, 0, len(vdevs)) for _, vdev := range vdevs { @@ -245,11 +246,11 @@ func (s *Service) CreatePool(name string, vdevs []string, options map[string]str } normalizedVdevs = append(normalizedVdevs, vdev) } - + if len(normalizedVdevs) == 0 { return fmt.Errorf("no valid vdevs provided after normalization") } - + args = append(args, normalizedVdevs...) // Log the command we're about to run for debugging