Do not necessarily error out if odo dev is stopped via Ctrl+C (#6917)

* Add test highlighting the expectations

* Propagate errors and call os.Exit only in 'main' functions

See ExitInMain[1] and ExitInMain_ExitOnce[2] coding convention guidelines.

[1] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-in-main
[2] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-once

* Handle errors returned by Cleanuper#Cleanup

This makes sure the exit code of the command
is mapped onto any error returned by Cleanup

* Do not return an error when the watch loop in 'odo dev' is interrupted

* Test that the exit code of 'odo dev' matches the error returned by the cleanup logic
This commit is contained in:
Armel Soro
2023-06-22 13:14:07 +02:00
committed by GitHub
parent 28ed064133
commit 147542db69
20 changed files with 272 additions and 86 deletions

View File

@@ -247,7 +247,11 @@ func handleWithRegistryExist(index int, registryList []Registry, operation strin
case "remove":
if !forceFlag {
if !ui.Proceed(fmt.Sprintf("Are you sure you want to %s registry %q", operation, registryName)) {
proceed, err := ui.Proceed(fmt.Sprintf("Are you sure you want to %s registry %q", operation, registryName))
if err != nil {
return nil, err
}
if !proceed {
log.Info("Aborted by the user")
return registryList, nil
}