tDefer and kill damhs.py and redis when exiting. - tordam - A library for peer discovery inside the Tor network HTML git clone https://git.parazyd.org/tordam DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit 49372b5d4c62690ea9d63f568f3b28596e5a8e86 DIR parent 43be00486d49717117eb9afefb875b149b579628 HTML Author: parazyd <parazyd@dyne.org> Date: Thu, 1 Nov 2018 13:43:01 +0100 Defer and kill damhs.py and redis when exiting. Diffstat: M cmd/dam-client/main.go | 3 +-- M cmd/dam-dir/main.go | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) --- DIR diff --git a/cmd/dam-client/main.go b/cmd/dam-client/main.go t@@ -258,6 +258,7 @@ func main() { log.Println("Starting up the hidden service.") cmd := exec.Command("damhs.py", lib.PrivKeyPath, lib.TorPortMap) + defer cmd.Process.Kill() stdout, err := cmd.StdoutPipe() lib.CheckError(err) t@@ -272,8 +273,6 @@ func main() { for !(ok) { t2 := time.Now().Unix() if t2-t1 > 90 { - err := cmd.Process.Kill() - lib.CheckError(err) log.Fatalln("Too much time has passed for publishing descriptor.") } time.Sleep(1000 * time.Millisecond) DIR diff --git a/cmd/dam-dir/main.go b/cmd/dam-dir/main.go t@@ -239,7 +239,8 @@ func main() { if _, err := lib.RedisCli.Ping().Result(); err != nil { // We assume redis is not running. Start it up. - _, err := lib.StartRedis(redconf) + cmd, err := lib.StartRedis(redconf) + defer cmd.Process.Kill() lib.CheckError(err) }