module Tinet::Shell
Constants
- DummyStatus
Public Instance Methods
sh(command, dry_run: false, print: false, continue: false)
click to toggle source
# File lib/tinet/shell.rb, line 16 def sh(command, dry_run: false, print: false, continue: false) if dry_run || print Tinet.logger.info command else Tinet.logger.debug command end return ['', '', DummyStatus.new(true)] if dry_run stdout, stderr, status = Open3.capture3(command) if !status.success? && !continue Tinet.logger.error "Command '#{command}' failed:" Tinet.logger.error " #{stderr.chomp}" unless stderr.chomp.empty? exit(status.to_i) end [stdout.chomp, stderr.chomp, status] end
sudo(command)
click to toggle source
# File lib/tinet/shell.rb, line 12 def sudo(command) sh "sudo #{command}" end