From f90241a6a37a14ae9d5fe678b6effc2bae462254 Mon Sep 17 00:00:00 2001 From: Paul Makepeace Date: Sun, 1 May 2016 20:58:59 -0700 Subject: [PATCH 1/2] Assert type against actual return val's interface. Exit code example produces now correctly, https://github.com/codegangsta/cli#exit-code ``` $ ./ec --ginger-crouton=false it is not in the soup $ echo $? 86 $ ``` --- app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.go b/app.go index a5b0aa32ef..696c05e183 100644 --- a/app.go +++ b/app.go @@ -438,7 +438,7 @@ func HandleAction(action interface{}, context *Context) (err error) { return errInvalidActionSignature } - if retErr, ok := reflect.ValueOf(vals[0]).Interface().(error); ok { + if retErr, ok := vals[0].Interface().(error); ok { return retErr } From fe67cb0f3ddab023e6ceec62c0d12ed0a414a83d Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Mon, 2 May 2016 11:41:01 -0400 Subject: [PATCH 2/2] Add note about error handling fix, prep 1.16.0 section --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c865e9bd0..39581e973b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ **ATTN**: This project uses [semantic versioning](http://semver.org/). ## [Unreleased] + +## [1.16.0] - 2016-05-02 ### Added - `Hidden` field on all flag struct types to omit from generated help text @@ -10,6 +12,9 @@ - `BashCompletionFlag` (`--enable-bash-completion`) is now omitted from generated help text via the `Hidden` field +### Fixed +- handling of error values in `HandleAction` and `HandleExitCoder` + ## [1.15.0] - 2016-04-30 ### Added - This file! @@ -257,7 +262,8 @@ signature of `func(*cli.Context) error`, as defined by `cli.ActionFunc`. ### Added - Initial implementation. -[Unreleased]: https://github.com/codegangsta/cli/compare/v1.15.0...HEAD +[Unreleased]: https://github.com/codegangsta/cli/compare/v1.16.0...HEAD +[1.16.0]: https://github.com/codegangsta/cli/compare/v1.15.0...v1.16.0 [1.15.0]: https://github.com/codegangsta/cli/compare/v1.14.0...v1.15.0 [1.14.0]: https://github.com/codegangsta/cli/compare/v1.13.0...v1.14.0 [1.13.0]: https://github.com/codegangsta/cli/compare/v1.12.0...v1.13.0