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
fastlane_core/spec/command_executor_spec.rb:12 is flaky #21792
Comments
The following script fails on some of my environments require 'pty'
require 'expect'
def run_command(command)
output = []
PTY.spawn(command) do |command_stdout, command_stdin, pid|
begin
command_stdout.each do |l|
line = l.chomp
output << line
end
rescue Errno::EIO
# This is expected on some linux systems, that indicates that the subcommand finished
# and we kept trying to read, ignore it
ensure
command_stdout.close
command_stdin.close
Process.wait(pid)
end
end
[$?.exitstatus, output.join("\n")]
end
def run_command2(command)
output = []
PTY.spawn(command) do |command_stdout, command_stdin, pid|
output = ""
begin
a = command_stdout.expect(/foo.*/, 5)
output = a[0] if a
ensure
command_stdout.close
command_stdin.close
Process.wait(pid)
end
end
[$?.exitstatus, output]
end
def test_spawn(command)
status, output = run_command(command)
errors = []
errors << "status was '#{status}'" unless status == 0
errors << "output was '#{output}'" unless output == "foo"
raise errors.join(" - ") unless errors.empty?
end
t = nil
pid = nil
if ENV['STRESS']
t = Thread.new do |t|
puts "Spawning stress"
pid = spawn("stress -c 16 -t 99", pgroup: true)
puts "Waiting #{pid}"
Process.wait(pid)
puts "#{pid} DONE"
end
end
command = "echo foo"
#command = "sh -c 'echo foo'"
#command = "ruby -e \"puts 'foo'\""
if ARGV.count == 1
command = ARGV[0]
end
puts "Will run command: '#{command}'"
errors = 0
1000.times do |i|
begin
test_spawn(command)
rescue => e
puts "ERROR #{i}: #{e}"
errors += 1
end
end
if t
Process.kill(:SIGKILL, -pid)
t.join
end
raise "Failed #{errors} times" unless errors == 0 You can edit the script to change
If you install the Here are some of my findings.
update so
I'll add that I tested this on a second Mac. On the second Mac, I didn't mange to reproduce the output issue. |
I've reported the issue to Ruby. https://bugs.ruby-lang.org/issues/20206. Waiting for some feedback. |
Related to #3821 maybe? |
I've found out the following running |
…astlane#21792) We don't have a simple way to disable the buffering in the terminal that is cross platform but quoting the parameter to echo does the job.
…astlane#21792) We don't have a simple way to disable the buffering in the terminal that is cross platform but quoting the parameter to echo does the job.
…astlane#21792) We don't have a simple way to disable the buffering in the terminal that is cross platform but quoting the parameter to echo does the job.
New Issue Checklist
Issue Description
Command executed
Complete output when running fastlane, including the stack trace and command used
Environment
The text was updated successfully, but these errors were encountered: