Class: Podjumper::Command
- Inherits:
-
Object
- Object
- Podjumper::Command
- Defined in:
- lib/podjumper/command.rb
Instance Method Summary collapse
- #exec(command) ⇒ Object
-
#initialize(info) ⇒ Command
constructor
A new instance of Command.
- #logs ⇒ Object
Constructor Details
#initialize(info) ⇒ Command
Returns a new instance of Command.
3 4 5 6 7 |
# File 'lib/podjumper/command.rb', line 3 def initialize(info) @namespace = info.namespace @pod = info.pod_name @container = info.container_name end |
Instance Method Details
#exec(command) ⇒ Object
9 10 11 12 13 |
# File 'lib/podjumper/command.rb', line 9 def exec(command) IO.popen(exec_command + command, in: :in) do |io| io.each_char(&method(:print)) end end |
#logs ⇒ Object
15 16 17 18 19 20 |
# File 'lib/podjumper/command.rb', line 15 def logs tty = TTY::Command.new(printer: :null) tty.run(*logs_command) do |out, _| puts out unless ping?(out) end end |