still fixing UI issue
Some checks failed
CI / test-build (push) Has been cancelled

This commit is contained in:
2025-12-18 15:28:58 +07:00
parent d9dcb00b0f
commit 4b11d839ec

View File

@@ -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