cmd/dlv: logger is not closed in connect command (#3367)

This commit is contained in:
Oleksandr Redko
2023-05-15 20:22:33 +03:00
committed by GitHub
parent 674bd63996
commit 1c9792bce4

View File

@ -818,16 +818,18 @@ func connectCmd(cmd *cobra.Command, args []string) {
os.Exit(1) os.Exit(1)
return return
} }
defer logflags.Close()
if loadConfErr != nil { if loadConfErr != nil {
logflags.DebuggerLogger().Errorf("%v", loadConfErr) logflags.DebuggerLogger().Errorf("%v", loadConfErr)
} }
addr := args[0] addr := args[0]
if addr == "" { if addr == "" {
fmt.Fprint(os.Stderr, "An empty address was provided. You must provide an address as the first argument.\n") fmt.Fprint(os.Stderr, "An empty address was provided. You must provide an address as the first argument.\n")
logflags.Close()
os.Exit(1) os.Exit(1)
} }
os.Exit(connect(addr, nil, conf, debugger.ExecutingOther)) ec := connect(addr, nil, conf, debugger.ExecutingOther)
logflags.Close()
os.Exit(ec)
} }
// waitForDisconnectSignal is a blocking function that waits for either // waitForDisconnectSignal is a blocking function that waits for either