Class: Rubu::ShellCommand
Overview
Shell based command.
Instance Attribute Summary
Attributes inherited from Move
#errmsg, #output, #status, #subs
Instance Method Summary (collapse)
-
- (ShellCommand) initialize(cmd)
constructor
A new instance of ShellCommand.
-
- (Object) run
Execution content.
Methods inherited from Move
#display, #error, #host, #host_in, #host_out, #use
Constructor Details
- (ShellCommand) initialize(cmd)
Returns a new instance of ShellCommand
122 123 124 125 |
# File 'lib/rubu.rb', line 122 def initialize( cmd ) super() @cmd = cmd end |
Instance Method Details
- (Object) run
Execution content.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/rubu.rb', line 128 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 |