[#1716] cli: Return trace ID on operation failure
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m21s
Build / Build Components (push) Successful in 1m46s
Pre-commit hooks / Pre-commit (push) Successful in 1m48s
Tests and linters / gopls check (push) Successful in 3m58s
Tests and linters / Run gofumpt (push) Successful in 4m21s
OCI image / Build container images (push) Successful in 4m45s
Tests and linters / Lint (push) Successful in 4m49s
Tests and linters / Staticcheck (push) Successful in 4m45s
Tests and linters / Tests with -race (push) Successful in 4m51s
Tests and linters / Tests (push) Successful in 4m55s
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m21s
Build / Build Components (push) Successful in 1m46s
Pre-commit hooks / Pre-commit (push) Successful in 1m48s
Tests and linters / gopls check (push) Successful in 3m58s
Tests and linters / Run gofumpt (push) Successful in 4m21s
OCI image / Build container images (push) Successful in 4m45s
Tests and linters / Lint (push) Successful in 4m49s
Tests and linters / Staticcheck (push) Successful in 4m45s
Tests and linters / Tests with -race (push) Successful in 4m51s
Tests and linters / Tests (push) Successful in 4m55s
Close #1716 Change-Id: I293d0cc6b7331517e8cde42eae07d65384976da5 Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
0ee7467da5
commit
410b6f70ba
1 changed files with 7 additions and 2 deletions
|
@ -51,8 +51,13 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
|
|||
}
|
||||
|
||||
cmd.PrintErrln(err)
|
||||
if cmd.PersistentPostRun != nil {
|
||||
cmd.PersistentPostRun(cmd, nil)
|
||||
for p := cmd; p != nil; p = p.Parent() {
|
||||
if p.PersistentPostRun != nil {
|
||||
p.PersistentPostRun(cmd, nil)
|
||||
if !cobra.EnableTraverseRunHooks {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
os.Exit(code)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue