Class: Cuttlebone::Drivers::Shell

Inherits:
Base
  • Object
show all
Defined in:
lib/cuttlebone/drivers/shell.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #sessions

Constructor Details

This class inherits a constructor from Cuttlebone::Drivers::Base

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cuttlebone/drivers/shell.rb', line 5

def run
  session = Cuttlebone::Session.sessions.create
  loop do
    break if session.terminated?
    command = Readline::readline("#{session.prompt} > ")
    break unless command
    Readline::HISTORY.push(command)
    _, _, output, error = session.call(command)
    print (output<<'').join("\n")
    print "\033[01;31m#{error}\033[00m\n" if error
  end
end