From 81b2697ccefc345a7dca8f3dd2ec2e9f83f15930 Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Thu, 22 Dec 2016 19:00:22 -0500 Subject: [PATCH] fix console exit, closes #35 --- cmd/tmsp-cli/tmsp-cli.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/tmsp-cli/tmsp-cli.go b/cmd/tmsp-cli/tmsp-cli.go index 50e954d9..cd9ae62e 100644 --- a/cmd/tmsp-cli/tmsp-cli.go +++ b/cmd/tmsp-cli/tmsp-cli.go @@ -19,6 +19,10 @@ import ( var client tmspcli.Client func main() { + + //workaround for the cli library (https://github.com/urfave/cli/issues/565) + cli.OsExiter = func(_ int) {} + app := cli.NewApp() app.Name = "tmsp-cli" app.Usage = "tmsp-cli [command] [args...]" @@ -171,10 +175,7 @@ func cmdConsole(app *cli.App, c *cli.Context) error { args := []string{"tmsp-cli"} args = append(args, strings.Split(string(line), " ")...) - if err := app.Run(args); err != nil { - // if the command doesn't succeed, inform the user without exiting - fmt.Println("Error:", err.Error()) - } + app.Run(args) //cli already prints error within its func call } }