Sha256: a132081c94eeae6c0df63760230a227961da4360749bee420247cd23eef15ba9
Contents?: true
Size: 919 Bytes
Versions: 2
Compression:
Stored size: 919 Bytes
Contents
require "mkit/cmd/shell_client" module MKIt class DockerExecCommand < MKIt::ShellClient def initialize(pod, ws, options: {}) puts "DockerExecCommand: #{options}" @pod = pod @ws = ws command = "docker exec" command += " -it" unless options[:detached] == 'true' command += " -d" if options[:detached] == 'true' command += " #{@pod.name}" command += " #{options[:varargs].join(' ')}" if options[:varargs] super(command: command) end 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.onmessage do |msg| stdin.putc msg end end @stdout_thread.join end end def close @ws.close_websocket unless @ws.nil? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mkit-0.9.0 | lib/mkit/pods/docker_exec_command.rb |
mkit-0.8.0 | lib/mkit/pods/docker_exec_command.rb |