We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
container = Docker::Container.create(Image: 'debian:latest', Cmd: ['sleep', 'infinity']) container.start container.exec(['sleep', 'infinity'], wait: 5) # Docker::Error::TimeoutError (read timeout reached) container.exec(['sleep', 'infinity'], wait: 5, stdin: StringIO.new('hello')) # hangs container.exec(['bash', '-c', 'cat; sleep infinity'], wait: 5, stdin: StringIO.new('hello')) # hangs
Hijacking the Excon socket instead of the underlying socket gets the timeout to work again but I don't know if that would break anything else:
diff --git a/lib/docker/util.rb b/lib/docker/util.rb index 2ca8dc6..432f26e 100644 --- a/lib/docker/util.rb +++ b/lib/docker/util.rb @@ -65,10 +65,10 @@ module Docker::Util debug "hijack: starting stdin copy thread" threads << Thread.start do debug "hijack: copying stdin => socket" - IO.copy_stream stdin, socket + socket.write stdin.read debug "hijack: closing write end of hijacked socket" - close_write(socket) + close_write(socket.instance_variable_get(:@socket)) end debug "hijack: starting hijacked socket read thread" @@ -76,7 +76,7 @@ module Docker::Util debug "hijack: reading from hijacked socket" begin - while chunk = socket.readpartial(512) + while chunk = socket.read(512) debug "hijack: got #{chunk.bytesize} bytes from hijacked socket" attach_block.call chunk, nil, nil end diff --git a/lib/excon/middlewares/hijack.rb b/lib/excon/middlewares/hijack.rb index 727cf29..b2b731c 100644 --- a/lib/excon/middlewares/hijack.rb +++ b/lib/excon/middlewares/hijack.rb @@ -39,7 +39,7 @@ module Excon datum[:response] = build_response(status, socket) Excon::Response.parse_headers(socket, datum) - datum[:hijack_block].call socket.instance_variable_get(:@socket) + datum[:hijack_block].call(socket) end @stack.response_call(datum) ~
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hijacking the Excon socket instead of the underlying socket gets the timeout to work again but I don't know if that would break anything else:
The text was updated successfully, but these errors were encountered: