When printing call-stacks from SIGQUIT, trim the buffer to remove garbage at the end

This commit is contained in:
Bryan Boreham committed 2015-01-19 16:54:40 +00:00
1 parent 24bd0a9a75
commit 404c7a1ad4
1 file changed
+2 -2
+2 -2
View File
@@ -168,8 +168,8 @@ func handleSignals(router *weave.Router) {
sig := <-sigs
switch sig {
case syscall.SIGQUIT:
runtime.Stack(buf, true)
log.Printf("=== received SIGQUIT ===\n*** goroutine dump...\n%s\n*** end\n", buf)
stacklen := runtime.Stack(buf, true)
log.Printf("=== received SIGQUIT ===\n*** goroutine dump...\n%s\n*** end\n", buf[:stacklen])
case syscall.SIGUSR1:
log.Printf("=== received SIGUSR1 ===\n*** status...\n%s\n*** end\n", router.Status())
}