summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2016-04-14 11:44:44 -0700
committerTim Smith <tsmith84@gmail.com>2016-04-14 11:44:44 -0700
commit0ee4f0f7e2a881446a0204c5efa5d75264db985b (patch)
tree0080e0219bde13699bc0d8ef40ce7278af68fd5a
parenta266d63e8baa7399782160af41ac88f8e287f9ef (diff)
downloadohai-0ee4f0f7e2a881446a0204c5efa5d75264db985b.tar.gz
Log that we couldn't shell out
-rw-r--r--lib/ohai/plugins/mono.rb42
1 files changed, 23 insertions, 19 deletions
diff --git a/lib/ohai/plugins/mono.rb b/lib/ohai/plugins/mono.rb
index e8daea43..5bfa5dcb 100644
--- a/lib/ohai/plugins/mono.rb
+++ b/lib/ohai/plugins/mono.rb
@@ -21,26 +21,30 @@ Ohai.plugin(:Mono) do
depends "languages"
collect_data do
- # Mono JIT compiler version 4.2.3 (Stable 4.2.3.4/832de4b Wed Mar 30 13:57:48 PDT 2016)
- # Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
- # TLS: normal
- # SIGSEGV: altstack
- # Notification: kqueue
- # Architecture: amd64
- # Disabled: none
- # Misc: softdebug
- # LLVM: supported, not enabled.
- # GC: sgen
- so = shell_out("mono -V")
- if so.exitstatus == 0
- output = nil
- mono = Mash.new
- output = so.stdout.split
- mono[:version] = output[4] if output.length >= 4
- if output.length >= 11
- mono[:builddate] = "%s %s %s %s %s %s" % [output[7], output[8], output[9], output[10], output[11], output[12].delete!(")")]
+
+ begin
+ # Mono JIT compiler version 4.2.3 (Stable 4.2.3.4/832de4b Wed Mar 30 13:57:48 PDT 2016)
+ # Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
+ # TLS: normal
+ # SIGSEGV: altstack
+ # Notification: kqueue
+ # Architecture: amd64
+ # Disabled: none
+ # Misc: softdebug
+ # LLVM: supported, not enabled.
+ # GC: sgen
+ so = shell_out("mono -V")
+ if so.exitstatus == 0
+ mono = Mash.new
+ output = so.stdout.split
+ mono[:version] = output[4] if output.length >= 4
+ if output.length >= 11
+ mono[:builddate] = "%s %s %s %s %s %s" % [output[7], output[8], output[9], output[10], output[11], output[12].delete!(")")]
+ end
+ languages[:mono] = mono unless mono.empty?
end
- languages[:mono] = mono unless mono.empty?
+ rescue Ohai::Exceptions::Exec
+ Ohai::Log.debug('Mono plugin: Could not shell_out "mono -v". Skipping plugin')
end
end
end