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

test: use IO#popen instead of Kernel#open #4369

Merged
merged 1 commit into from
Jan 10, 2024
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
8 changes: 4 additions & 4 deletions test/plugin_helper/test_child_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def configure(conf)
unless Fluent.windows?
test 'can specify subprocess name' do
io = IO.popen([["cat", "caaaaaaaaaaat"], '-'])
process_naming_enabled = (open("|ps opid,cmd"){|_io| _io.readlines }.count{|line| line.include?("caaaaaaaaaaat") } > 0)
process_naming_enabled = (IO.popen(["ps", "opid,cmd"]){|_io| _io.readlines }.count{|line| line.include?("caaaaaaaaaaat") } > 0)
Process.kill(:TERM, io.pid) rescue nil
io.close rescue nil

Expand All @@ -576,7 +576,7 @@ def configure(conf)
m.lock
ran = true
pids << @d.child_process_id
proc_lines += open("|ps opid,cmd"){|_io| _io.readlines }
proc_lines += IO.popen(["ps", "opid,cmd"]){|_io| _io.readlines }
m.unlock
readio.read
end
Expand Down Expand Up @@ -635,8 +635,8 @@ def configure(conf)
unless Fluent.windows?
test 'can change working directory' do
# check my real /tmp directory (for mac)
cmd = %[|ruby -e 'Dir.chdir("/tmp"); puts Dir.pwd']
mytmpdir = open(cmd){|io| io.read.chomp }
cmd = ['ruby', '-e', 'Dir.chdir("/tmp"); puts Dir.pwd']
mytmpdir = IO.popen(cmd){|io| io.read.chomp }

m = Mutex.new
str = nil
Expand Down
Loading