From 13ca445e13bafd6c5216b3c408092d78ee3c5bac Mon Sep 17 00:00:00 2001 From: John Bellone Date: Thu, 8 Aug 2013 12:16:28 -0400 Subject: [PATCH] Update packer.go to cleanup plugin clients on exit. Since defer does not fire when exiting the application with os.Exit we need to be sure that we cleanup all of the clients on failures from the CLI and creating a new environment object. --- packer.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packer.go b/packer.go index 590e7ea3c..e1049b231 100644 --- a/packer.go +++ b/packer.go @@ -90,6 +90,7 @@ func main() { env, err := packer.NewEnvironment(envConfig) if err != nil { fmt.Fprintf(os.Stderr, "Packer initialization error: \n\n%s\n", err) + plugin.CleanupClients() os.Exit(1) } @@ -98,6 +99,7 @@ func main() { exitCode, err := env.Cli(os.Args[1:]) if err != nil { fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error()) + plugin.CleanupClients() os.Exit(1) }