Class: CommandExecutor
- Inherits:
-
Object
- Object
- CommandExecutor
- Includes:
- Singleton
- Defined in:
- lib/vpn_routing_mac/command_executor.rb
Defined Under Namespace
Classes: CommandFailed
Instance Attribute Summary collapse
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
Instance Attribute Details
#verbose ⇒ Object
Returns the value of attribute verbose.
5 6 7 |
# File 'lib/vpn_routing_mac/command_executor.rb', line 5 def verbose @verbose end |
Instance Method Details
#execute!(command, verbose: @verbose, exception: true) ⇒ Object
execute command
18 19 20 21 22 23 24 25 |
# File 'lib/vpn_routing_mac/command_executor.rb', line 18 def execute!(command, verbose: @verbose, exception: true) puts "cmd: #{command}" if verbose ret, err, status = Open3.capture3(command) raise CommandFailed.new(err) if exception && !status.success? ret end |
#instance ⇒ Object
9 10 11 |
# File 'lib/vpn_routing_mac/command_executor.rb', line 9 def instance @verbose = false end |