mirror of
https://github.com/harness/drone.git
synced 2025-05-01 21:21:11 +00:00
Revert "Fix segfault in model.Tree(procs)"
This reverts commit 83b81769df037e1f2910f85e25aa7f8fe3e71ddc.
This commit is contained in:
parent
83b81769df
commit
2d47ebf3cf
@ -44,17 +44,16 @@ func (p *Proc) Failing() bool {
|
||||
// Tree creates a process tree from a flat process list.
|
||||
func Tree(procs []*Proc) []*Proc {
|
||||
var (
|
||||
nodes []*Proc
|
||||
parent *Proc
|
||||
children []*Proc
|
||||
nodes []*Proc
|
||||
parent *Proc
|
||||
)
|
||||
for _, proc := range procs {
|
||||
if proc.PPID == 0 {
|
||||
nodes = append(nodes, proc)
|
||||
parent = proc
|
||||
parent.Children = children
|
||||
continue
|
||||
} else {
|
||||
children = append(children, proc)
|
||||
parent.Children = append(parent.Children, proc)
|
||||
}
|
||||
}
|
||||
return nodes
|
||||
|
Loading…
x
Reference in New Issue
Block a user