Class: Rubu::ShellCommand
Overview
Shell based command.
Instance Attribute Summary
Attributes inherited from Action
#errmsg, #output, #status, #subs
Instance Method Summary (collapse)
-
- (ShellCommand) initialize(cmd)
constructor
A new instance of ShellCommand.
- - (Object) run
Methods inherited from Action
#display, #error, #host, #host_in, #host_out, #pick, #use
Constructor Details
- (ShellCommand) initialize(cmd)
Returns a new instance of ShellCommand
115 116 117 118 |
# File 'lib/rubu.rb', line 115 def initialize( cmd ) super() @cmd = cmd end |
Instance Method Details
- (Object) run
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/rubu.rb', line 120 def run begin stdout, stderr, status = Open3.capture3( @cmd ) if Order[ :verbose ] STDOUT.puts @cmd end if status.exitstatus == 0 @status = :success else @status = :error error( stderr ) end rescue error( "Invalid command: \"#{@cmd}\"..." ) @status = :error end self end |