mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-20 12:23:26 +00:00
fix: cross-platform SysProcAttr for non-Windows builds
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/internal/buildinfo"
|
||||
@@ -224,9 +223,7 @@ func startSubprocess(opts StartOptions) (Status, error) {
|
||||
if strings.TrimSpace(opts.RepoRoot) != "" {
|
||||
cmd.Dir = opts.RepoRoot
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
|
||||
}
|
||||
setSysProcAttr(cmd)
|
||||
// Enable management endpoints for the local ProxyPilot UX by setting a per-user secret.
|
||||
// This is used to unlock /v0/management routes while keeping remote management disabled by default.
|
||||
pw, errPw := getOrCreateManagementPassword()
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//go:build !windows
|
||||
|
||||
package desktopctl
|
||||
|
||||
import "os/exec"
|
||||
|
||||
// setSysProcAttr is a no-op on non-Windows platforms.
|
||||
func setSysProcAttr(cmd *exec.Cmd) {
|
||||
// No special attributes needed on Unix-like systems
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//go:build windows
|
||||
|
||||
package desktopctl
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// setSysProcAttr sets Windows-specific process attributes to hide the console window.
|
||||
func setSysProcAttr(cmd *exec.Cmd) {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
|
||||
}
|
||||
Reference in New Issue
Block a user