Skip to content

Commit

Permalink
change logic for tty resize to avoid warning in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vieux committed Oct 24, 2013
1 parent e661473 commit 0e44864
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
cli.forwardAllSignals(cmd.Arg(0))
}

if container.Config.Tty {
if container.Config.Tty && cli.isTerminal {
if err := cli.monitorTtySize(cmd.Arg(0)); err != nil {
return err
}
Expand Down Expand Up @@ -1340,9 +1340,9 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
return fmt.Errorf("Impossible to attach to a stopped container, start it first")
}

if container.Config.Tty {
if container.Config.Tty && cli.isTerminal {
if err := cli.monitorTtySize(cmd.Arg(0)); err != nil {
utils.Debugf("Error monitoring tty size: %s", err)
utils.Debugf("Error monitoring TTY size: %s", err)
}
}

Expand Down Expand Up @@ -1666,7 +1666,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
return err
}

if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty {
if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty && cli.isTerminal {
if err := cli.monitorTtySize(runResult.ID); err != nil {
utils.Errorf("Error monitoring TTY size: %s\n", err)
}
Expand Down Expand Up @@ -1969,9 +1969,6 @@ func (cli *DockerCli) resizeTty(id string) {
}

func (cli *DockerCli) monitorTtySize(id string) error {
if !cli.isTerminal {
return fmt.Errorf("Impossible to monitor size on non-tty")
}
cli.resizeTty(id)

sigchan := make(chan os.Signal, 1)
Expand Down

0 comments on commit 0e44864

Please sign in to comment.