lib/vnctools/server.rb in vnctools-0.0.9.pre1 vs lib/vnctools/server.rb in vnctools-0.0.9
- old
+ new
@@ -80,10 +80,17 @@
def last_status
$?
end
def host
- @host ||= Socket.gethostname
+ @host ||= (
+ # Java 6 and 7 is inconsistent in its return value, so attempt to read /etc/hostname if possible
+ if defined?(JRUBY_VERSION) && File.exist?("/etc/hostname")
+ File.read("/etc/hostname").strip
+ else
+ Socket.gethostname
+ end
+ )
end
end # VncServer
end # CukeForker