Skip to content

Calling cmd.Parent().PreRunE(cmd, args) in Third lavel of child is making it infinite loop  #1483

@tiwarisanjay

Description

@tiwarisanjay

Hi,
In the example .
I am trying to print the PreRunE of add function starting from child.
Command to run :

  • go run main.go add addchild addchildchild

Where output supposed to be :

inside init
inside main
inside initConfig
Add Prerun E : addChildChild Function
Add Prerun E  : addChild Function
Add Prerun E : add Function

But Ouptut I am getting is :

inside init
inside main
inside initConfig
Add Prerun E : addChildChild Function
Add Prerun E  : addChild Function
Add Prerun E  : addChild Function
Add Prerun E  : addChild Function
Add Prerun E  : addChild Function
.
.
.

Not sure if I am missing something for the concept. I debug the code and parent for addChild is showing add but something is throwing it in infinite and addChild is calling itself again for parent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/needs-infoNeeds more investigation from maintainers or more info from the issue provider

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions