@@ -101,7 +101,7 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
101101 return err
102102 }
103103 if ! options .Detach {
104- if err := dockerCLI .In ().CheckTty (execOptions .AttachStdin , execOptions .Tty ); err != nil {
104+ if err := dockerCLI .In ().CheckTty (execOptions .AttachStdin , execOptions .TTY ); err != nil {
105105 return err
106106 }
107107 }
@@ -119,27 +119,20 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
119119 }
120120
121121 if options .Detach {
122- var cs client.ConsoleSize
123- if execOptions .ConsoleSize != nil {
124- cs = client.ConsoleSize {
125- Height : execOptions .ConsoleSize [0 ],
126- Width : execOptions .ConsoleSize [1 ],
127- }
128- }
129122 _ , err := apiClient .ExecStart (ctx , execID , client.ExecStartOptions {
130123 Detach : options .Detach ,
131- TTY : execOptions .Tty ,
132- ConsoleSize : cs ,
124+ TTY : execOptions .TTY ,
125+ ConsoleSize : client. ConsoleSize { Height : execOptions . ConsoleSize . Height , Width : execOptions . ConsoleSize . Width } ,
133126 })
134127 return err
135128 }
136129 return interactiveExec (ctx , dockerCLI , execOptions , execID )
137130}
138131
139132func fillConsoleSize (execOptions * client.ExecCreateOptions , dockerCli command.Cli ) {
140- if execOptions .Tty {
133+ if execOptions .TTY {
141134 height , width := dockerCli .Out ().GetTtySize ()
142- execOptions .ConsoleSize = & [ 2 ] uint { height , width }
135+ execOptions .ConsoleSize = client. ConsoleSize { Height : height , Width : width }
143136 }
144137}
145138
@@ -157,7 +150,7 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *cl
157150 out = dockerCli .Out ()
158151 }
159152 if execOptions .AttachStderr {
160- if execOptions .Tty {
153+ if execOptions .TTY {
161154 stderr = dockerCli .Out ()
162155 } else {
163156 stderr = dockerCli .Err ()
@@ -166,16 +159,9 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *cl
166159 fillConsoleSize (execOptions , dockerCli )
167160
168161 apiClient := dockerCli .Client ()
169- var cs client.ConsoleSize
170- if execOptions .ConsoleSize != nil {
171- cs = client.ConsoleSize {
172- Height : execOptions .ConsoleSize [0 ],
173- Width : execOptions .ConsoleSize [1 ],
174- }
175- }
176162 resp , err := apiClient .ExecAttach (ctx , execID , client.ExecAttachOptions {
177- TTY : execOptions .Tty ,
178- ConsoleSize : cs ,
163+ TTY : execOptions .TTY ,
164+ ConsoleSize : client. ConsoleSize { Height : execOptions . ConsoleSize . Height , Width : execOptions . ConsoleSize . Width } ,
179165 })
180166 if err != nil {
181167 return err
@@ -193,15 +179,15 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *cl
193179 outputStream : out ,
194180 errorStream : stderr ,
195181 resp : resp .HijackedResponse ,
196- tty : execOptions .Tty ,
182+ tty : execOptions .TTY ,
197183 detachKeys : execOptions .DetachKeys ,
198184 }
199185
200186 return streamer .stream (ctx )
201187 }()
202188 }()
203189
204- if execOptions .Tty && dockerCli .In ().IsTerminal () {
190+ if execOptions .TTY && dockerCli .In ().IsTerminal () {
205191 if err := MonitorTtySize (ctx , dockerCli , execID , true ); err != nil {
206192 _ , _ = fmt .Fprintln (dockerCli .Err (), "Error monitoring TTY size:" , err )
207193 }
@@ -237,7 +223,7 @@ func parseExec(execOpts ExecOptions, configFile *configfile.ConfigFile) (*client
237223 execOptions := & client.ExecCreateOptions {
238224 User : execOpts .User ,
239225 Privileged : execOpts .Privileged ,
240- Tty : execOpts .TTY ,
226+ TTY : execOpts .TTY ,
241227 Cmd : execOpts .Command ,
242228 WorkingDir : execOpts .Workdir ,
243229 }
0 commit comments