@@ -63,7 +63,6 @@ func main() {
6363 _ , _ , isTty := sess .Pty ()
6464 cfg := & container.Config {
6565 Image : defaultImage ,
66- Cmd : sess .Command (),
6766 Env : sess .Environ (),
6867 Tty : isTty ,
6968 OpenStdin : true ,
@@ -165,19 +164,19 @@ func dockerRun(cfg *container.Config, hostcfg *container.HostConfig, sess ssh.Se
165164 status = 255
166165 cleanup = func () {}
167166 ctx := context .Background ()
167+ useTty := true
168168
169169 cImage := cfg .Image
170170 InfoPrint ("Image: %s" , cImage )
171171 defaultCmd := []string {"/bin/sh" , "-c" , "/bin/bash || /bin/sh" }
172172
173+ if sess .RawCommand () != "" {
174+ defaultCmd = sess .Command ()
175+ useTty = false
176+ }
173177 if cmd != "" {
174178 defaultCmd = strings .Fields (cmd )
175179 }
176-
177- if sess .RawCommand () != "" {
178- sess .Write ([]byte ("not implemented, use -cmd option\n " ))
179- return
180- }
181180 InfoPrint ("Executing command: %s" , defaultCmd )
182181
183182 networkingConfig := network.NetworkingConfig {}
@@ -235,7 +234,7 @@ func dockerRun(cfg *container.Config, hostcfg *container.HostConfig, sess ssh.Se
235234 }
236235 InfoPrint ("Attaching container: %s" , resp .ID )
237236 stream , err := docker .ContainerExecAttach (ctx , execResp .ID , container.ExecStartOptions {
238- Tty : true ,
237+ Tty : useTty ,
239238 })
240239 if err != nil {
241240 ErrorPrint ("Error during container attach: [%v]" , err .Error ())
0 commit comments