Avoid setting ENV["PATH"] in cmdtest itself.
Instead set PATH in the shell scripts used to execute the actual commands to test.
This commit is contained in:
parent
02270c3aa9
commit
a0663562f0
@ -190,13 +190,6 @@ module Cmdtest
|
|||||||
@orig_env_path.dup
|
@orig_env_path.dup
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_env_path(path_arr)
|
|
||||||
path_str = path_arr.join(_path_separator)
|
|
||||||
if path_str != ENV["PATH"]
|
|
||||||
ENV["PATH"] = path_str
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def run
|
def run
|
||||||
@orig_cwd = Dir.pwd
|
@orig_cwd = Dir.pwd
|
||||||
ENV["PATH"] = Dir.pwd + _path_separator + ENV["PATH"]
|
ENV["PATH"] = Dir.pwd + _path_separator + ENV["PATH"]
|
||||||
|
@ -521,9 +521,8 @@ module Cmdtest
|
|||||||
|
|
||||||
@_runner.notify("cmdline", @_cmdline, @_comment_str)
|
@_runner.notify("cmdline", @_cmdline, @_comment_str)
|
||||||
@_comment_str = nil
|
@_comment_str = nil
|
||||||
@_runner.set_env_path(@_env_path)
|
|
||||||
@_t1 = Time.now
|
@_t1 = Time.now
|
||||||
@_effects = @_work_dir.run_cmd(@_cmdline)
|
@_effects = @_work_dir.run_cmd(@_cmdline, @_env_path)
|
||||||
@_t2 = Time.now
|
@_t2 = Time.now
|
||||||
|
|
||||||
@_checked_status = false
|
@_checked_status = false
|
||||||
|
@ -90,6 +90,14 @@ module Cmdtest
|
|||||||
File.join(Workdir.tmp_cmdtest_dir, "tmp-stderr.log")
|
File.join(Workdir.tmp_cmdtest_dir, "tmp-stderr.log")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def _set_env_path_str(env_path)
|
||||||
|
if _windows
|
||||||
|
"set path=" + env_path.join(";")
|
||||||
|
else
|
||||||
|
"export PATH=" + env_path.join(":")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def _ruby_S(cmdline)
|
def _ruby_S(cmdline)
|
||||||
if @runner.opts.ruby_s
|
if @runner.opts.ruby_s
|
||||||
if cmdline =~ /ruby/
|
if cmdline =~ /ruby/
|
||||||
@ -102,8 +110,9 @@ module Cmdtest
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_cmd(cmdline)
|
def run_cmd(cmdline, env_path)
|
||||||
File.open(_tmp_command_sh, "w") do |f|
|
File.open(_tmp_command_sh, "w") do |f|
|
||||||
|
f.puts _set_env_path_str(env_path)
|
||||||
f.puts _ruby_S(cmdline)
|
f.puts _ruby_S(cmdline)
|
||||||
end
|
end
|
||||||
str = "%s %s > %s 2> %s" % [
|
str = "%s %s > %s 2> %s" % [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user