ruby-changes:56297
From: Nobuyoshi <ko1@a...>
Date: Sun, 30 Jun 2019 21:39:16 +0900 (JST)
Subject: [ruby-changes:56297] Nobuyoshi Nakada: 3b86ec2251 (trunk): dtrace: check for the command availablity with sudo
https://git.ruby-lang.org/ruby.git/commit/?id=3b86ec2251 From 3b86ec22515853665c353f2fb14e5bdb10b2e65b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 30 Jun 2019 18:41:17 +0900 Subject: dtrace: check for the command availablity with sudo diff --git a/test/dtrace/helper.rb b/test/dtrace/helper.rb index 023d116..7b382e8 100644 --- a/test/dtrace/helper.rb +++ b/test/dtrace/helper.rb @@ -52,7 +52,17 @@ else https://github.com/ruby/ruby/blob/trunk/test/dtrace/helper.rb#L52 warn "don't know how to check if built with #{impl} support" cmd = false end -ok &= system(*cmd, err: IO::NULL, out: IO::NULL) if cmd + +NEEDED_ENVS = [RbConfig::CONFIG["LIBPATHENV"], "RUBY", "RUBYOPT"].compact + +if cmd and ok + sudocmd = [] + if sudo + sudocmd << sudo + NEEDED_ENVS.each {|name| val = ENV[name] and sudocmd << "#{name}=#{val}"} + end + ok = system(*sudocmd, *cmd, err: IO::NULL, out: IO::NULL) +end module DTrace class TestCase < Test::Unit::TestCase @@ -136,8 +146,8 @@ module DTrace https://github.com/ruby/ruby/blob/trunk/test/dtrace/helper.rb#L146 cmd = [*DTRACE_CMD, "-q", "-s", d_path, "-c", cmd ] end if sudo = @@sudo - [RbConfig::CONFIG["LIBPATHENV"], "RUBY", "RUBYOPT"].each do |name| - if name and val = ENV[name] + NEEDED_ENVS.each do |name| + if val = ENV[name] cmd.unshift("#{name}=#{val}") end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/