terminal: ask for confirmation when using 'quit -c' with breakpoints (#3398)

This commit is contained in:
Alessandro Arzilli
2023-06-07 05:46:56 +02:00
committed by GitHub
parent ea13a24f38
commit 9b17415e83

View File

@ -2876,6 +2876,20 @@ func exitCommand(t *Term, ctx callContext, args string) error {
if !t.client.IsMulticlient() {
return errors.New("not connected to an --accept-multiclient server")
}
bps, _ := t.client.ListBreakpoints(false)
hasUserBreakpoints := false
for _, bp := range bps {
if bp.ID >= 0 {
hasUserBreakpoints = true
break
}
}
if hasUserBreakpoints {
yes, _ := yesno(t.line, "There are breakpoints set, do you wish to quit and continue without clearing breakpoints? [Y/n] ", "yes")
if !yes {
return nil
}
}
t.quitContinue = true
}
return ExitRequestError{}