Don't display duplicate subtrees with captree.

This addresses issue (1) of:

  https://bugzilla.kernel.org/show_bug.cgi?id=214269

Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
diff --git a/goapps/captree/captree.go b/goapps/captree/captree.go
index 4c7a586..f6bdaa4 100644
--- a/goapps/captree/captree.go
+++ b/goapps/captree/captree.go
@@ -88,6 +88,7 @@
 
 type task struct {
 	mu       sync.Mutex
+	viewed   bool
 	pid      string
 	cmd      string
 	cap      *cap.Set
@@ -183,6 +184,13 @@
 		fmt.Println("[PID:", pid, "not found]")
 		return
 	}
+	if info.viewed {
+		// This process (tree) has already been viewed so skip
+		// repeating it.
+		return
+	}
+	info.viewed = true
+
 	c := ""
 	set := info.cap
 	if set != nil {