Due to a server misconfiguration issue, we were low on memory.

Attempting to spawn a subprocess to get the uname threw an out of
memory error.  Since the uname is only needed to provide diagnostic
info in the User-Agent, it shouldn't cause stripe to fail.
This commit is contained in:
Grant Olson 2013-03-20 10:56:39 -04:00
parent ce34d9ef8b
commit 81ae6d7aee

View File

@ -106,7 +106,7 @@ module Stripe
:ssl_ca_file => @@ssl_bundle_path
}
end
uname = (@@uname ||= RUBY_PLATFORM =~ /linux|darwin/i ? `uname -a 2>/dev/null`.strip : nil)
uname = get_uname
lang_version = "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})"
ua = {
:bindings_version => Stripe::VERSION,
@ -197,6 +197,13 @@ module Stripe
private
def self.get_uname
(@@uname ||= RUBY_PLATFORM =~ /linux|darwin/i ? `uname -a 2>/dev/null`.strip : nil)
rescue Errno::ENOMEM => ex # couldn't create subprocess
"uname lookup died"
end
def self.execute_request(opts)
RestClient::Request.execute(opts)
end