Files
Pulse/scripts/installtests/nasfixturecollector/main.go
pulse-triage[bot] a3679d6a43 Use a native-built inert collector in NAS watchdog controls
The private NAS fixture copied /bin/sleep and relied on its renamed process identity. Build a bounded Go collector instead and require its fixed readiness marker through the generated wrapper's retained stderr, as well as exact kernel process ownership. Preserve actual wrappers, teardown/parser, all stop and cleanup assertions, and existing deadlines. This removes a platform-owned executable assumption; it does not diagnose or clear the preceding macOS failures or establish native appliance recovery.

Contract-Neutral: Private fixture executable and readiness proof only; production installer, process ownership, safety deadlines and wire contracts are unchanged.
Change-source: pulse-maintainer
2026-10-13 15:20:17 +01:00

36 lines
1.1 KiB
Go

// nasfixturecollector is an inert, native-built input for the private NAS
// watchdog/removal fixture. It has no agent, service, network or state access.
package main
import (
"errors"
"fmt"
"io"
"os"
"time"
)
const ready = "private NAS fixture collector ready\n"
func run(args []string, output io.Writer, wait func(time.Duration)) error {
// The generated wrapper passes this one fixed lifetime. Reject anything
// else rather than allowing an accidentally unbounded fixture process.
if len(args) != 1 || args[0] != "30" {
return errors.New("private NAS fixture requires its fixed 30-second lifetime")
}
if n, err := io.WriteString(output, ready); err != nil || n != len(ready) {
return errors.New("private NAS fixture could not record readiness")
}
wait(30 * time.Second)
return nil
}
func main() {
// Both generated wrappers discard stdout and retain stderr in their own
// watchdog log. This fixed marker discloses no process arguments or paths.
if err := run(os.Args[1:], os.Stderr, time.Sleep); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}