replace with_clean_env with with_unbundled_env (#12615)

This commit is contained in:
João Duarte 2021-01-29 17:31:35 +00:00 committed by GitHub
parent 3fb12747f5
commit 023e11a8e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View file

@ -94,7 +94,7 @@ class LogstashService < Service
# Given an input this pipes it to LS. Expects a stdin input in LS # Given an input this pipes it to LS. Expects a stdin input in LS
def start_with_input(config, input) def start_with_input(config, input)
Bundler.with_clean_env do Bundler.with_unbundled_env do
`cat #{Shellwords.escape(input)} | #{Shellwords.escape(@logstash_bin)} -e \'#{config}\'` `cat #{Shellwords.escape(input)} | #{Shellwords.escape(@logstash_bin)} -e \'#{config}\'`
end end
end end
@ -111,7 +111,7 @@ class LogstashService < Service
# Useful to test metrics and such # Useful to test metrics and such
def start_with_stdin def start_with_stdin
puts "Starting Logstash #{@logstash_bin} -e #{STDIN_CONFIG}" puts "Starting Logstash #{@logstash_bin} -e #{STDIN_CONFIG}"
Bundler.with_clean_env do Bundler.with_unbundled_env do
out = Tempfile.new("duplex") out = Tempfile.new("duplex")
out.sync = true out.sync = true
@process = build_child_process("-e", STDIN_CONFIG) @process = build_child_process("-e", STDIN_CONFIG)
@ -134,7 +134,7 @@ class LogstashService < Service
# Spawn LS as a child process # Spawn LS as a child process
def spawn_logstash(*args) def spawn_logstash(*args)
Bundler.with_clean_env do Bundler.with_unbundled_env do
@process = build_child_process(*args) @process = build_child_process(*args)
@env_variables.map { |k, v| @process.environment[k] = v} unless @env_variables.nil? @env_variables.map { |k, v| @process.environment[k] = v} unless @env_variables.nil?
java_home = java.lang.System.getProperty('java.home') java_home = java.lang.System.getProperty('java.home')
@ -245,7 +245,7 @@ class LogstashService < Service
end end
process.io.stdout = process.io.stderr = out process.io.stdout = process.io.stderr = out
Bundler.with_clean_env do Bundler.with_unbundled_env do
if change_dir if change_dir
Dir.chdir(@logstash_home) do Dir.chdir(@logstash_home) do
process.start process.start

View file

@ -40,7 +40,7 @@ module LogStash
def self.run(cmd, debug=false) def self.run(cmd, debug=false)
# This block is require to be able to launch a ruby subprocess # This block is require to be able to launch a ruby subprocess
# that use bundler. # that use bundler.
Bundler.with_clean_env do Bundler.with_unbundled_env do
stdin, stdout, stderr, wait_thr = Open3.popen3(cmd) stdin, stdout, stderr, wait_thr = Open3.popen3(cmd)
stdout_acc, stderr_acc = "", "" stdout_acc, stderr_acc = "", ""
stdout_reporter = reporter(stdout, wait_thr) do |c| stdout_reporter = reporter(stdout, wait_thr) do |c|

View file

@ -120,7 +120,7 @@ module LogStash module Docgen
def run_in_directory(cmd = nil, &block) def run_in_directory(cmd = nil, &block)
Dir.chdir(path) do Dir.chdir(path) do
Bundler.with_clean_env do Bundler.with_unbundled_env do
stdin, stdout, stderr, wait_thr = Open3.popen3(cmd) stdin, stdout, stderr, wait_thr = Open3.popen3(cmd)
if wait_thr.value.success? if wait_thr.value.success?
return stdout return stdout

View file

@ -41,7 +41,7 @@ describe "Pack the dependencies", :integration => true do
FileUtils.rm_rf(bundler_config) FileUtils.rm_rf(bundler_config)
FileUtils.rm_rf(vendor_path) FileUtils.rm_rf(vendor_path)
Bundler.with_clean_env do Bundler.with_unbundled_env do
Dir.chdir(path) do Dir.chdir(path) do
system(bundler_cmd) system(bundler_cmd)
system(rake_cmd) system(rake_cmd)
@ -69,7 +69,7 @@ describe "Pack the dependencies", :integration => true do
FileUtils.rm_rf(bundler_config) FileUtils.rm_rf(bundler_config)
FileUtils.rm_rf(vendor_path) FileUtils.rm_rf(vendor_path)
Bundler.with_clean_env do Bundler.with_unbundled_env do
Dir.chdir(path) do Dir.chdir(path) do
system(bundler_cmd) system(bundler_cmd)
system(rake_cmd) system(rake_cmd)