Class: Fission::Action::ShellExecutor
- Defined in:
- lib/fission/action/shell_executor.rb
Instance Method Summary collapse
-
#execute ⇒ Object
Internal: Executes the command in the shell.
-
#initialize(cmd) ⇒ ShellExecutor
constructor
Internal: Create a new ShellExecutor object.
Constructor Details
#initialize(cmd) ⇒ ShellExecutor
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.
15 16 17 |
# File 'lib/fission/action/shell_executor.rb', line 15 def initialize(cmd) @cmd = cmd end |
Instance Method Details
#execute ⇒ Object
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.
30 31 32 |
# File 'lib/fission/action/shell_executor.rb', line 30 def execute { 'output' => `#{@cmd}`, 'process_status' => $? } end |