class Fission::Action::ShellExecutor

Public Class Methods

new(cmd) click to toggle source

Internal: Create a new ShellExecutor object.

cmd - Command to execute as a String

Examples:

Fission::Action::ShellExecutor.new 'ls /var/log'

Returns a new Fission::Action::ShellExecutor object.

# File lib/fission/action/shell_executor.rb, line 15
def initialize(cmd)
  @cmd = cmd
end

Public Instance Methods

execute() click to toggle source

Internal: Executes the command in the shell. The command will be executed using the ruby '`' method.

Examples:

@executor.execute

Returns a Hash with two keys. The key 'output' will contain the output from the command. The key 'process_status' will conatian a standard ruby Process::Status object.

# File lib/fission/action/shell_executor.rb, line 30
def execute
  { 'output' => %x`#{@cmd}`, 'process_status' => $? }
end