diff options
author | Tim Smith <tsmith@chef.io> | 2017-03-01 22:56:28 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2017-03-01 22:56:28 -0800 |
commit | adf042d7fcd696f1f29ad3e35f26ec52ce9d11e4 (patch) | |
tree | 2b454eaf83b18f313c319f58086c327766742a28 | |
parent | ca3bdf456c80b68e48e6a380624640f8f85d7811 (diff) | |
download | ohai-adf042d7fcd696f1f29ad3e35f26ec52ce9d11e4.tar.gz |
Properly detect scalascala
It seems that sometimes scala outputs a bogus line ahead out the version output. Use a match instead of a split to better handle this sort of thing.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/ohai/plugins/scala.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ohai/plugins/scala.rb b/lib/ohai/plugins/scala.rb index ee905a64..1f019bb2 100644 --- a/lib/ohai/plugins/scala.rb +++ b/lib/ohai/plugins/scala.rb @@ -23,9 +23,10 @@ Ohai.plugin(:Scala) do begin so = shell_out("scala -version") # Sample output: - # Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL + # cat: /release: No such file or directory + # Scala code runner version 2.12.1 -- Copyright 2002-2016, LAMP/EPFL and Lightbend, Inc. if so.exitstatus == 0 - scala[:version] = so.stderr.split[4] + scala[:version] = so.stderr.match(/.*version (\S*)/)[1] end rescue Ohai::Exceptions::Exec Ohai::Log.debug('Plugin Scala: Could not shell_out "scala -version". Skipping data') |