feat: execute durable client commands through supervisor

This commit is contained in:
2026-09-06 12:18:15 +00:00
parent 3f84d3b2f1
commit 56b15c7f4f
41 changed files with 4272 additions and 66 deletions
+42
View File
@@ -0,0 +1,42 @@
//go:build windows
package main
import (
"context"
"errors"
"fmt"
"io"
"os"
"path/filepath"
"github.com/rvbox/rvbox/internal/client/windowsservice"
"golang.org/x/sys/windows/svc"
)
func defaultClientConfigPath() string {
root := os.Getenv("ProgramData")
if root == "" {
root = `C:\ProgramData`
}
return filepath.Join(root, "RVBox", "client.toml")
}
func runService(configPath string, diagnostics io.Writer) error {
inService, err := svc.IsWindowsService()
if err != nil {
return fmt.Errorf("detect service control manager context: %w", err)
}
if !inService {
return errors.New("--service is reserved for the installed Windows service")
}
return runWindowsService(configPath, diagnostics)
}
func runWindowsService(configPath string, diagnostics io.Writer) error {
return windowsservice.Run(func(ctx context.Context) error { return runClientDaemon(ctx, configPath, diagnostics) })
}
func runTray(configPath string, diagnostics io.Writer) error {
return errors.New("Windows tray frontend is not available in this build")
}