Skip to content

Commit

Permalink
Replace sys_command usages in context.rb (#1017)
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored Sep 10, 2020
1 parent c6b44a3 commit 81bca30
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/raven/context.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'rbconfig'
require 'etc'

module Raven
class Context
Expand All @@ -24,18 +25,22 @@ def initialize

class << self
def os_context
@os_context ||= {
:name => Raven.sys_command("uname -s") || RbConfig::CONFIG["host_os"],
:version => Raven.sys_command("uname -v"),
:build => Raven.sys_command("uname -r"),
:kernel_version => Raven.sys_command("uname -a") || Raven.sys_command("ver") # windows
}
@os_context ||=
begin
uname = Etc.uname
{
name: uname[:sysname] || RbConfig::CONFIG["host_os"],
version: uname[:version],
build: uname[:release],
kernel_version: uname[:version]
}
end
end

def runtime_context
@runtime_context ||= {
:name => RbConfig::CONFIG["ruby_install_name"],
:version => Raven.sys_command("ruby -v")
name: RbConfig::CONFIG["ruby_install_name"],
version: RUBY_DESCRIPTION || Raven.sys_command("ruby -v")
}
end
end
Expand Down

0 comments on commit 81bca30

Please sign in to comment.