lib/snmp/open/command_reader.rb in snmp-open-0.2.0 vs lib/snmp/open/command_reader.rb in snmp-open-0.3.0

- old
+ new

@@ -52,10 +52,11 @@ out, err = if @env Open3.capture3(@env, cli(cmd, oid, options)) else Open3.capture3(cli(cmd, oid, options)) end + raise CommandTimeoutError, err.chomp if err =~ /^timeout/i raise CommandError, err.chomp unless err.empty? out end # Generate a CLI command string @@ -120,7 +121,8 @@ end end end # class CommandReader class CommandError < RuntimeError; end + class CommandTimeoutError < CommandError; end end # class Open end # module SNMP