all repos — honk @ ce8d4c258351ca27b14d3eff7c107c7ad715b792

my fork of honk

backend should exit after parent
Ted Unangst tedu@tedunangst.com
Wed, 23 Feb 2022 15:24:58 -0500
commit

ce8d4c258351ca27b14d3eff7c107c7ad715b792

parent

dad197e0b7e2ba1d0fb12908d635a87e9458eb83

2 files changed, 15 insertions(+), 2 deletions(-)

jump to
M backend.gobackend.go

@@ -74,8 +74,16 @@ }

var backendhooks []func() +func orphancheck() { + var b [1]byte + os.Stdin.Read(b[:]) + dlog.Printf("backend shutting down") + os.Exit(0) +} + func backendServer() { dlog.Printf("backend server running") + go orphancheck() shrinker := new(Shrinker) srv := rpc.NewServer() err := srv.Register(shrinker)

@@ -104,10 +112,15 @@ srv.Accept(lis)

} func runBackendServer() { + r, _, err := os.Pipe() + if err != nil { + elog.Panicf("can't pipe: %s", err) + } proc := exec.Command(os.Args[0], reexecArgs("backend")...) proc.Stdout = os.Stdout proc.Stderr = os.Stderr - err := proc.Start() + proc.Stdin = r + err = proc.Start() if err != nil { elog.Panicf("can't exec backend: %s", err) }
M honk.gohonk.go

@@ -100,7 +100,7 @@ Time *Time

Mentions []Mention Badonks []Badonk Wonkles string - Guesses template.HTML + Guesses template.HTML } type Badonk struct {