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.



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

def initialize(command)
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/isolation/command_runner.rb', line 3

def command
  @command
end

#error_messageObject

Returns the value of attribute error_message.



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

def error_message
  @error_message
end

#success_statusObject Also known as: success?

Returns the value of attribute success_status.



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

def success_status
  @success_status
end

Instance Method Details

#runObject



11
12
13
14
15
16
# File 'lib/isolation/command_runner.rb', line 11

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