Exit from docker login on SIGTERM and SIGINT.

Fixes #1299.
Upstream-commit: 01ce312c2d3e56a7993f7d644675513e1acca17c
Component: engine
This commit is contained in:
David Calavera
2013-07-26 17:40:45 -07:00
parent e53564ccbf
commit 8a695e82cd

View File

@ -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)