From 202ce62cc309aa06d7a3a236ba6822de68335d61 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Fri, 26 Jul 2013 17:40:45 -0700 Subject: [PATCH] Exit from `docker login` on SIGTERM and SIGINT. Fixes #1299. Upstream-commit: f1d0625cf895abd1e6b22db3470216b9b9c5ef29 Component: engine --- components/engine/commands.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/engine/commands.go b/components/engine/commands.go index 236fb65d10..53f6706ae4 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -333,6 +333,14 @@ func (cli *DockerCli) CmdLogin(args ...string) error { authconfig = auth.AuthConfig{} } + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) + go func() { + for sig := range c { + os.Exit(1) + } + }() + if *flUsername == "" { promptDefault("Username", authconfig.Username) username = readAndEchoString(cli.in, cli.out)