Class: Isolation::CommandRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/isolation/command_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ CommandRunner

Returns a new instance of CommandRunner.



9
10
11
# File 'lib/isolation/command_runner.rb', line 9

def initialize(command)
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



5
6
7
# File 'lib/isolation/command_runner.rb', line 5

def command
  @command
end

#error_messageObject

Returns the value of attribute error_message.



6
7
8
# File 'lib/isolation/command_runner.rb', line 6

def error_message
  @error_message
end

#success_statusObject Also known as: success?

Returns the value of attribute success_status.



6
7
8
# File 'lib/isolation/command_runner.rb', line 6

def success_status
  @success_status
end

Instance Method Details

#runObject



13
14
15
16
17
18
# File 'lib/isolation/command_runner.rb', line 13

def run
  Open3.popen3(ENV, command) do |stdin, stdout, stderr, wait_thr|
    self.success_status = wait_thr.value.success?
    self.error_message = stderr.read
  end
end