From f8eefd5c72e0d98e1bcaa64a92ba9db3d2fea857 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Mon, 27 Apr 2020 21:14:05 -0400 Subject: [PATCH] check to see if backend server dies --- backend.go | 4 +++- web.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend.go b/backend.go index 8ad3117..a4800bc 100644 --- a/backend.go +++ b/backend.go @@ -100,7 +100,7 @@ func backendServer() { srv.Accept(lis) } -func startBackendServer() { +func runBackendServer() { proc := exec.Command(os.Args[0], "-datadir", dataDir, "backend") proc.Stdout = os.Stdout proc.Stderr = os.Stderr @@ -108,4 +108,6 @@ func startBackendServer() { if err != nil { log.Panicf("can't exec backend: %s", err) } + err = proc.Wait() + log.Panicf("lost the backend: %s", err) } diff --git a/web.go b/web.go index 7459c7a..5a985e0 100644 --- a/web.go +++ b/web.go @@ -2325,7 +2325,7 @@ func serve() { if err != nil { log.Fatal(err) } - startBackendServer() + go runBackendServer() go enditall() go redeliverator() go tracker()