Class: Amiral::Providers::LastLine

Inherits:
Object
  • Object
show all
Defined in:
lib/amiral/providers/last-line.rb

Instance Method Summary collapse

Instance Method Details

#execute(message) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/amiral/providers/last-line.rb', line 7

def execute message

  cmd = message['command']['args'].join " "

  out = err = nil
  status = POpen4::popen4(cmd){|stdout, stderr, stdin, pid|
    out = stdout.read
    err = stderr.read
  }
  {
    :exit => 0,
    :short =>  "status: #{status.exitstatus}, out: #{out.split(/\n/).last}",
    :out => out,
    :err => err
  }
end