Class: Webcmd::CommandRunner
- Inherits:
-
Object
- Object
- Webcmd::CommandRunner
- Defined in:
- lib/webcmd/command_runner.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(command) ⇒ CommandRunner
constructor
A new instance of CommandRunner.
Constructor Details
#initialize(command) ⇒ CommandRunner
Returns a new instance of CommandRunner.
3 4 5 |
# File 'lib/webcmd/command_runner.rb', line 3 def initialize(command) @command = command end |
Instance Method Details
#each(&block) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/webcmd/command_runner.rb', line 7 def each(&block) IO.popen([shell_env, 'bash', '-l', err: [:child, :out]], 'w+') do |shell| shell.write @command shell.close_write shell.each_line(&block) end end |