Method: Perus::Pinger::Command#shell
- Defined in:
- lib/perus/pinger/command.rb
#shell(command) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/perus/pinger/command.rb', line 127 def shell(command) out, err, status = Open3.capture3(command) if status.exitstatus > 0 && !err.empty? raise ShellCommandError.new("(cmd: #{command}) => #{err.strip}; #{out.strip}; exit: #{status.exitstatus}") end if status.exitstatus > 0 raise ShellCommandError.new("(cmd: #{command}) => #{out.strip}; exit: #{status.exitstatus}") end out end |