Clean up comment sections and fix typos in CmdRun

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
This commit is contained in:
Phil Estes 2014-10-19 02:47:53 -04:00
parent a10876d355
commit d2cd8e77a6
1 changed files with 9 additions and 9 deletions

View File

@ -2186,7 +2186,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
config.StdinOnce = false config.StdinOnce = false
} }
// Disable flSigProxy in case on TTY // Disable flSigProxy when in TTY mode
sigProxy := *flSigProxy sigProxy := *flSigProxy
if config.Tty { if config.Tty {
sigProxy = false sigProxy = false
@ -2208,7 +2208,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
) )
if !config.AttachStdout && !config.AttachStderr { if !config.AttachStdout && !config.AttachStderr {
// Make this asynchrone in order to let the client write to stdin before having to read the ID // Make this asynchronous to allow the client to write to stdin before having to read the ID
waitDisplayId = make(chan struct{}) waitDisplayId = make(chan struct{})
go func() { go func() {
defer close(waitDisplayId) defer close(waitDisplayId)
@ -2220,7 +2220,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
return ErrConflictRestartPolicyAndAutoRemove return ErrConflictRestartPolicyAndAutoRemove
} }
// We need to instanciate the chan because the select needs it. It can // We need to instantiate the chan because the select needs it. It can
// be closed but can't be uninitialized. // be closed but can't be uninitialized.
hijacked := make(chan io.Closer) hijacked := make(chan io.Closer)
@ -2267,8 +2267,8 @@ func (cli *DockerCli) CmdRun(args ...string) error {
// Acknowledge the hijack before starting // Acknowledge the hijack before starting
select { select {
case closer := <-hijacked: case closer := <-hijacked:
// Make sure that hijack gets closed when returning. (result // Make sure that the hijack gets closed when returning (results
// in closing hijack chan and freeing server's goroutines. // in closing the hijack chan and freeing server's goroutines)
if closer != nil { if closer != nil {
defer closer.Close() defer closer.Close()
} }
@ -2320,15 +2320,15 @@ func (cli *DockerCli) CmdRun(args ...string) error {
return err return err
} }
} else { } else {
// No Autoremove: Simply retrieve the exit code
if !config.Tty { if !config.Tty {
// In non-tty mode, we can't dettach, so we know we need to wait. // In non-TTY mode, we can't detach, so we must wait for container exit
if status, err = waitForExit(cli, runResult.Get("Id")); err != nil { if status, err = waitForExit(cli, runResult.Get("Id")); err != nil {
return err return err
} }
} else { } else {
// In TTY mode, there is a race. If the process dies too slowly, the state can be update after the getExitCode call // In TTY mode, there is a race: if the process dies too slowly, the state could
// and result in a wrong exit code. // be updated after the getExitCode call and result in the wrong exit code being reported
// No Autoremove: Simply retrieve the exit code
if _, status, err = getExitCode(cli, runResult.Get("Id")); err != nil { if _, status, err = getExitCode(cli, runResult.Get("Id")); err != nil {
return err return err
} }