Stack cleanup for subcommands

This commit is contained in:
Austin Roberts 2021-08-17 16:11:59 -05:00
parent 5f0574bbc4
commit d2df0b4c5f

View File

@ -315,8 +315,11 @@ func geth(ctx *cli.Context) error {
prepare(ctx) prepare(ctx)
stack, backend := makeFullNode(ctx) stack, backend := makeFullNode(ctx)
pluginsInitializeNode(stack, backend) pluginsInitializeNode(stack, backend)
if ok, err := plugins.RunSubcommand(ctx); ok {
stack.Close()
return err
}
defer stack.Close() defer stack.Close()
if ok, err := plugins.RunSubcommand(ctx); ok { return err }
if !plugins.ParseFlags(ctx.Args()) { if !plugins.ParseFlags(ctx.Args()) {
if args := ctx.Args(); len(args) > 0 { if args := ctx.Args(); len(args) > 0 {
return fmt.Errorf("invalid command: %q", args[0]) return fmt.Errorf("invalid command: %q", args[0])