Class: TDX::Exec
- Inherits:
-
Object
- Object
- TDX::Exec
- Defined in:
- lib/tdx/exec.rb
Overview
Command line executor
Instance Method Summary collapse
-
#initialize(cmd, dir = '.') ⇒ Exec
constructor
A new instance of Exec.
- #stdout ⇒ Object
Constructor Details
#initialize(cmd, dir = '.') ⇒ Exec
Returns a new instance of Exec.
36 37 38 39 40 |
# File 'lib/tdx/exec.rb', line 36 def initialize(cmd, dir = '.') @cmd = cmd @dir = dir @log = false end |
Instance Method Details
#stdout ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/tdx/exec.rb', line 42 def stdout puts "+ #{@cmd}" if @log out = `cd #{@dir} && #{@cmd}` raise "This one failed: #{@cmd}" unless $CHILD_STATUS.exitstatus == 0 puts out if @log out end |