Class: Rvm2::Shell::Runner::Local

Inherits:
Object
  • Object
show all
Defined in:
lib/rvm2/shell/runner/local.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell = "sh") ⇒ Local

Returns a new instance of Local.



6
7
8
# File 'lib/rvm2/shell/runner/local.rb', line 6

def initialize(shell = "sh")
  @shell = shell
end

Instance Attribute Details

#last_statusObject (readonly)

Returns the value of attribute last_status.



4
5
6
# File 'lib/rvm2/shell/runner/local.rb', line 4

def last_status
  @last_status
end

#shellObject (readonly)

Returns the value of attribute shell.



4
5
6
# File 'lib/rvm2/shell/runner/local.rb', line 4

def shell
  @shell
end

Instance Method Details

#execute(command) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rvm2/shell/runner/local.rb', line 10

def execute(command)
  @last_status = nil
  shell_session.execute(command) do |out, err|
    yield(out, err)
  end
  @last_status = shell_session.status
end

#shell_sessionObject



18
19
20
# File 'lib/rvm2/shell/runner/local.rb', line 18

def shell_session
  @shell_session ||= Session::Sh.new(:prog => shell)
end