Comments (4)
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
- the number of iterations
- the command to test
If you install the stress
program, it will help adding some stress to the system to make the issues easier to reproduce.
Here are some of my findings.
STRESS=y ruby test_pty.rb "echo foo"
[...]
ERROR 39: output was ''
ERROR 57: output was ''
ERROR 181: output was ''
ERROR 279: output was ''
ERROR 303: output was ''
ERROR 307: output was ''
ERROR 376: output was ''
[...]
test_pty.rb:83:in `<main>': Failed 16 times (RuntimeError)
STRESS=y ruby test_pty.rb "echo 'foo'"
works
update STRESS=y ruby test_pty.rb "echo 'foo'"
used to fail, but this was fixed with closing the output/input.
so
echo foo
andecho 'foo'
behave differently- the first one reproduces the empty output rather regularly
the second one reproduces #8258. This seems to happen only after running the test a few times, and I have a hard time to reproduce this at fresh start. Still it's a weird issue.
I'll add that I tested this on a second Mac. On the second Mac, I didn't mange to reproduce the output issue.
from fastlane.
I've reported the issue to Ruby. https://bugs.ruby-lang.org/issues/20206. Waiting for some feedback.
from fastlane.
Related to #3821 maybe?
from fastlane.
I've found out the following
running ruby test_pty.rb "echo 'foo'"
or ruby test_pty.rb "stdbuf -i0 -o0 -e0 echo foo"
doesn't reproduce the failure. So this could very much be caused by buffering issues on the terminal side. I still don't yet undertand how why echo "foo"
and echo foo
impact the buffering. I'll update the code to take this into account. Hopefully that will reduce the flakyness.
from fastlane.
Related Issues (20)
- fastlane sigh download_all and "Error parsing provisioning profile at path..."
- fastlane match HOT 4
- bundler: command not found: fastlane
- Individual API Key not supported HOT 3
- fastlane deliver init is not working in CLI
- JEG2/highline should be updated to avoid warning of abbrev missing in standard lib for ruby 3.3.0
- How to get raw exit code from Fastlane HOT 3
- Match import to s3 Crash on encrypting. HOT 2
- Provisioning profile expiration comparison compares Time and DateTime
- AvailableTerritories is deprecated and fastlane is not upgraded to new api endpoints HOT 5
- Match managing provisioning profiles for DriverKit
- curb-1.0.0/lib/curl/easy.rb - Failed to read/open file HOT 1
- `match` behaves differently in v2.220.0: `wrong final block length` HOT 12
- Can't upload build to Test Flight; [!] undefined method `refresh!' HOT 2
- A parameter has an invalid value - 'prices' is not a valid relationship name HOT 10
- I run the command 'fastlane match development'. and i got the following error: Looking for related GitHub issues on fastlane/fastlane... Found no similar issues. To create a new issue, please visit: https://github.com/fastlane/fastlane/issues/new Run fastlane env to append the fastlane environment to your issue [!] The request could not be completed because: This request is forbidden for security reasons - You currently don't have access to this membership resource. Contact your team's Account Holder, or an Admin.
- Build_for_testing fails sporadically with error 'Could not find or use auto-linked framework' HOT 2
- Can fastlane support filling in Chinaโs ICP registration number?
- [match] provisioning profile generated via match blocks release installation on TestFlight (or on device) HOT 1
- if and switch expressions Swift HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastlane.