diff --git a/lib/logstash/util.rb b/lib/logstash/util.rb index bf2c0087ae1..a25603f52a0 100644 --- a/lib/logstash/util.rb +++ b/lib/logstash/util.rb @@ -1,13 +1,18 @@ require "logstash/namespace" require "ffi" # gem ffi -require "sys/uname" # gem sys-uname module LogStash::Util PR_SET_NAME = 15 - # This can throw an exception, if it does, we're probably not - # on linux. - UNAME = Sys::Uname.uname.sysname rescue "unknown" + # This can throw an exception, if it does, we're probably not on linux. + # It certainly throws an exception on Windows; I don't know how + # to work around it other than this hack. + begin + require "sys/uname" # gem sys-uname + UNAME = Sys::Uname.uname.sysname + rescue LoadError, NotFoundError + UNAME = "unknown" + end module LibC extend FFI::Library