ListeningOn on Windows ran Get-NetTCPConnection with -ErrorAction
SilentlyContinue. When nothing listens the cmdlet fails with
ObjectNotFound, and PowerShell still exits 1 for it, so the read answered
"exit status 1" where lsof and /proc answer no pids and no error. The
Gateway page's take-over waits for exactly that answer to know the older
magpie let the port go; with an error it waited out its deadline and said
"stuck" with the port already free. The command now catches the error and
exits 0 only for ObjectNotFound; any other failure (the cmdlet missing, a
PowerShell cut short) is still an error.
JasonBuildAI's 85a8c8c0 reads "exit 1 with nothing on either stream" as
none found instead. Catching the category keeps a silent failure of
another kind an error, so this takes that route; his separate point that
the darwin reader has no deadline guard is not in this commit.
Run:
- TestNothingListeningIsNoError (new), on the Windows box: old code FAIL
"nothing listens on 56409: exit status 1", new PASS; TestListeningOn
passes on both. go test ./internal/proc on macOS: ok.
- TestGatewayFixQuitsOnlyAMagpie (internal/gui) on the Windows box: old
code FAIL "take-over: {OK:false Reason:stuck ...}" after 12.5s; with
this change the take-over succeeds (the test's own cleanup failure is
the next commit). With both, 3 of 3 PASS in ~7s each.
- go test -tags nogui ./... on macOS with this series: every package ok.
- gofmt -l, go vet ./... on darwin, linux (nogui) and windows: clean.