projects
/
arvados.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7545efd
)
When running in a jvm, get the OK name and version from java's system properties...
author
Adam Sawyer <asawyer@google.com>
Tue, 13 Mar 2012 18:41:58 +0000
(14:41 -0400)
committer
Adam Sawyer <asawyer@google.com>
Tue, 13 Mar 2012 18:41:58 +0000
(14:41 -0400)
lib/google/api_client/environment.rb
patch
|
blob
|
history
diff --git
a/lib/google/api_client/environment.rb
b/lib/google/api_client/environment.rb
index 9faa28f7d6d67b96b5e18865cd88d0707b84fbe6..bc49788af9770e40a3f397e24c8295ea1e4a6538 100644
(file)
--- a/
lib/google/api_client/environment.rb
+++ b/
lib/google/api_client/environment.rb
@@
-24,6
+24,13
@@
module Google
`ver`.sub(/\s*\[Version\s*/, '/').sub(']', '').strip
elsif RUBY_PLATFORM =~ /darwin/i
"Mac OS X/#{`sw_vers -productVersion`}"
`ver`.sub(/\s*\[Version\s*/, '/').sub(']', '').strip
elsif RUBY_PLATFORM =~ /darwin/i
"Mac OS X/#{`sw_vers -productVersion`}"
+ elsif RUBY_PLATFORM == 'java'
+ # Get the information from java system properties to avoid spawning a
+ # sub-process, which is not friendly in some contexts (web servers).
+ require 'java'
+ name = java.lang.System.getProperty('os.name')
+ version = java.lang.System.getProperty('os.version')
+ "#{name} #{version}"
else
`uname -sr`.sub(' ', '/')
end
else
`uname -sr`.sub(' ', '/')
end