Class: MKIt::DockerExecCommand
- Inherits:
-
ShellClient
- Object
- ShellClient
- MKIt::DockerExecCommand
- Defined in:
- lib/mkit/pods/docker_exec_command.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(pod, ws, options: {}) ⇒ DockerExecCommand
constructor
A new instance of DockerExecCommand.
- #register ⇒ Object
Methods inherited from ShellClient
Constructor Details
#initialize(pod, ws, options: {}) ⇒ DockerExecCommand
Returns a new instance of DockerExecCommand.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/mkit/pods/docker_exec_command.rb', line 6 def initialize(pod, ws, options: {}) puts "DockerExecCommand: #{}" @pod = pod @ws = ws command = "docker exec" command += " -it" unless [:detached] == 'true' command += " -d" if [:detached] == 'true' command += " #{@pod.name}" command += " #{[:varargs].join(' ')}" if [:varargs] super(command: command) end |
Instance Method Details
#close ⇒ Object
33 34 35 |
# File 'lib/mkit/pods/docker_exec_command.rb', line 33 def close @ws.close_websocket unless @ws.nil? end |
#register ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mkit/pods/docker_exec_command.rb', line 18 def register super do |stdout, stdin, pid| @stdout_thread = Thread.new do stdout.each_char { |line| @ws.send(line) } end @stdin_thread = Thread.new do @ws. do |msg| stdin.putc msg end end @stdout_thread.join end end |