Whois 0.8.0 was released with a new command line tool to perform one-line WHOIS queries.
$ ruby-whois google.com
WHOIS requests can fail and, unfortunately, the existing version of the CLI doesn't handle this case very well. When an exception is raised, the CLI exits printing an unfriendly Ruby stack trace.
$ ruby-whois karnaugh.za.net /Users/weppos/.rvm/ruby-1.8.7-p174/lib/ruby/1.8/timeout.rb:60:in `ask_the_socket': execution expired (Timeout::Error) from /Users/weppos/.rvm/gems/ruby/1.8.7/gems/whois-0.8.1/lib/whois/server/adapters/base.rb:77:in `query_the_socket' from /Users/weppos/.rvm/gems/ruby/1.8.7/gems/whois-0.8.1/lib/whois/server/adapters/standard.rb:34:in `request' from /Users/weppos/.rvm/gems/ruby/1.8.7/gems/whois-0.8.1/lib/whois/server/adapters/base.rb:52:in `query' from /Users/weppos/.rvm/gems/ruby/1.8.7/gems/whois-0.8.1/lib/whois/server/adapters/base.rb:66:in `with_buffer' from /Users/weppos/.rvm/gems/ruby/1.8.7/gems/whois-0.8.1/lib/whois/server/adapters/base.rb:51:in `query' from /Users/weppos/.rvm/gems/ruby/1.8.7/gems/whois-0.8.1/lib/whois/client.rb:72:in `query' from /Users/weppos/.rvm/gems/ruby/1.8.7/gems/whois-0.8.1/lib/whois/client.rb:70:in `query' from /Users/weppos/.rvm/gems/ruby/1.8.7/gems/whois-0.8.1/bin/ruby-whois:37 from /Users/weppos/.rvm/gems/ruby/1.8.7/bin/ruby-whois:19:in `load' from /Users/weppos/.rvm/gems/ruby/1.8.7/bin/ruby-whois:19
I'm happy to say that now his is just a bad memory. In case of error, the new CLI writes the error message to
STDERR then terminates the execution and sets the exit status to
$ ruby-whois karnaugh.za.net Request Timeout $ ruby-whois google.es This TLD has no whois server, but you can access the whois database at `https://www.nic.es/'