moul / ssh2docker

:whale: standalone SSH server that connects you to your Docker containers

Home Page:https://manfred.life/ssh2docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stdin -> docker exec is closed too early

moul opened this issue · comments

stdin -> docker exec is closed too early

testing

server

hook script always accept the connection but sleep during two seconds to simulate some API calls etc

$ make && ./ssh2docker -V --publickey-auth-script=./examples/sleep-yes-publickey-auth-script
...

client

done: printing 50 lines in 0.5sec
result: nothing is printed

$ assh sockets flush; (for i in {1..50}; do echo $i; sleep .01; done) | ssh ubuntu@localhost -p 2222 -- cat -e; assh sockets flush

done: printing 50 lines in 5 secs
result:

  • we can see 25 lines that should be the output of the buffer
  • then we can see 25 lines without '$' at the end of the line, which are the 25 buffered lines, sent in one-shot to the cat -e in the docker exec
  • then we can see 25 lines with a $ at the end, which are the result of the cat -e on the buffered lines
  • and finally, we can see the rest of the lines treated line by line by the cat -e, without buffering
$ assh sockets flush; (for i in {1..50}; do echo $i; sleep .1; done) | ssh ubuntu@localhost -p 2222 -- cat -e; assh sockets flush
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
1$
2$
3$
4$
5$
6$
7$
8$
9$
10$
11$
12$
13$
14$
15$
16$
17$
18$
19$
20$
21$
22$
23$
24$
25$
26$
27
27$
28
28$
29
29$
30
30$
31
31$
32
32$
33
33$
34
34$
35
35$
36
36$
37
37$
38
38$
39
39$
40
40$
41
41$
42
42$
43
43$
44
44$
45
45$
46
46$
47
47$
48
48$
49
49$
50
50$

@QuentinPerez, I will need some help :p

Partially fixed :)