diff --git a/components/engine/commands.go b/components/engine/commands.go index 0fabaa385f..1fb56e98a6 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -319,6 +319,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 == "" { fmt.Fprintf(cli.out, "Username (%s): ", authconfig.Username) username = readAndEchoString(cli.in, cli.out)