These fix the issues identified by the k/k inspired linter
configuration that we will be adding:
```
pkg/pid1/pid1.go:72:14: ST1005: error strings should not end with punctuation or newlines (stylecheck)
return 0, fmt.Errorf("unhandled exit status: 0x%x\n", status)
^
pkg/pid1/pid1.go:86:21: ST1005: error strings should not end with punctuation or newlines (stylecheck)
return false, 0, fmt.Errorf("wait4(): %w\n", err)
^
main.go:480:34: Error return value of `pflag.CommandLine.MarkDeprecated` is not checked (errcheck)
pflag.CommandLine.MarkDeprecated("branch", "use --ref instead")
^
main.go:483:34: Error return value of `pflag.CommandLine.MarkDeprecated` is not checked (errcheck)
pflag.CommandLine.MarkDeprecated("change-permissions", "use --group-write instead")
^
main.go:486:34: Error return value of `pflag.CommandLine.MarkDeprecated` is not checked (errcheck)
pflag.CommandLine.MarkDeprecated("dest", "use --link instead")
^
main.go:1897:16: Error return value of `io.WriteString` is not checked (errcheck)
io.WriteString(h, s)
^
main.go:555:2: ifElseChain: rewrite if-else to switch statement (gocritic)
if *flDeprecatedBranch != "" && (*flDeprecatedRev == "" || *flDeprecatedRev == "HEAD") {
^
```
1) Was calling Wait() on the child process, but also calling Wait4,
which would race, causing an occasional error or panic.
2) In testing (1), I observed occasional hangs. Tracing it down to a
SIGWINCH, which masked a SIGCHLD, causing it to hang. Both seem fixed.
Added a manual test script.
This detects when it is running as pid 1, and becomes an init process.
Specifically this means handling SIGCHLD and reaping processes
(otherwise they become zombies) and forwarding signals to "real"
process.
We fork and re-exec ourselves so that we only get *this* SIGCHLD for
orphaned processes (re-parented to 1) and not the real events from
running things like git or ssh.