Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace sys_command usages in context.rb #1017

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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