Class: SystemCat::Shell
- Inherits:
-
Object
- Object
- SystemCat::Shell
- Defined in:
- lib/system_cat/shell.rb
Class Method Summary collapse
- .exec(command, test: false) ⇒ Object
- .exitstatus ⇒ Object
- .run(command, force: false, test: false) ⇒ Object
Class Method Details
.exec(command, test: false) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/system_cat/shell.rb', line 6 def self.exec(command, test: false) puts '_______________________________________________________________________________' puts command return if test Kernel.exec(command) end |
.exitstatus ⇒ Object
28 29 30 |
# File 'lib/system_cat/shell.rb', line 28 def self.exitstatus $CHILD_STATUS.exitstatus end |
.run(command, force: false, test: false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/system_cat/shell.rb', line 15 def self.run(command, force: false, test: false) puts '_______________________________________________________________________________' puts command return if test result = `#{command}` puts result raise 'Command failed' unless exitstatus.zero? || force return result end |