mirror of
https://github.com/harness/drone.git
synced 2025-05-02 13:40:22 +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.
|
// Tree creates a process tree from a flat process list.
|
||||||
func Tree(procs []*Proc) []*Proc {
|
func Tree(procs []*Proc) []*Proc {
|
||||||
var (
|
var (
|
||||||
nodes []*Proc
|
nodes []*Proc
|
||||||
parent *Proc
|
parent *Proc
|
||||||
children []*Proc
|
|
||||||
)
|
)
|
||||||
for _, proc := range procs {
|
for _, proc := range procs {
|
||||||
if proc.PPID == 0 {
|
if proc.PPID == 0 {
|
||||||
nodes = append(nodes, proc)
|
nodes = append(nodes, proc)
|
||||||
parent = proc
|
parent = proc
|
||||||
parent.Children = children
|
continue
|
||||||
} else {
|
} else {
|
||||||
children = append(children, proc)
|
parent.Children = append(parent.Children, proc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nodes
|
return nodes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user