Browse Source

Use a more idiomatic syntax to capture the exit.

David Calavera 12 years ago
parent
commit
c3154fdf4d
1 changed files with 4 additions and 5 deletions
  1. 4 5
      commands.go

+ 4 - 5
commands.go

@@ -333,12 +333,11 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
 		authconfig = auth.AuthConfig{}
 	}
 
-	c := make(chan os.Signal, 1)
-	signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
+	sigchan := make(chan os.Signal, 1)
+	signal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM)
 	go func() {
-		for sig := range c {
-			os.Exit(1)
-		}
+		<-sigchan
+		os.Exit(1)
 	}()
 
 	if *flUsername == "" {