Class: CertCheck::Shell
- Inherits:
-
Object
- Object
- CertCheck::Shell
- Defined in:
- lib/openvpn_cert_nagios/shell.rb
Overview
Execute shell commands. Simple popen3 wrapper, that returns either STDOUT or exit status, and aborts on non zero status.
Class Method Summary collapse
Class Method Details
.exe(cmd) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/openvpn_cert_nagios/shell.rb', line 7 def self.exe(cmd) Open3.popen3({"PATH" => "/usr/bin:/bin:/usr/sbin:/sbin"}, cmd) do |stdin, stdout, stderr, process| stdin.close raise "#{cmd} FAILED: #{stderr.read} #{ stdout.read }" if process.value != 0 stdout.readlines end end |