diff options
author | Tim Smith <tsmith@chef.io> | 2017-03-01 22:43:53 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2017-03-01 22:43:53 -0800 |
commit | 11e7f786e767dd41398d1309e133173f47eb731e (patch) | |
tree | 606740957f985780cc8162838de3bd092f1a1522 /lib/ohai/plugins/lua.rb | |
parent | ca3bdf456c80b68e48e6a380624640f8f85d7811 (diff) | |
download | ohai-lua.tar.gz |
Fix lua detection on new versions of lualua
Newer versions of lua output lua -v on stdout while older versions use
stderr. This update will handle both and ensure that we continue to
detect the installed lua version.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/ohai/plugins/lua.rb')
-rw-r--r-- | lib/ohai/plugins/lua.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ohai/plugins/lua.rb b/lib/ohai/plugins/lua.rb index 8c1ff496..ad91c91d 100644 --- a/lib/ohai/plugins/lua.rb +++ b/lib/ohai/plugins/lua.rb @@ -27,7 +27,9 @@ Ohai.plugin(:Lua) do # Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio if so.exitstatus == 0 lua = Mash.new - lua[:version] = so.stderr.split[1] + # at some point in lua's history they went from outputting the version + # on stderr to doing it on stdout. This handles old / new versions + lua[:version] = so.stdout.empty? ? so.stderr.split[1] : so.stdout.split[1] languages[:lua] = lua if lua[:version] end rescue Ohai::Exceptions::Exec |