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 `2.219.0` was published without changes. HOT 2
- "ar-SA - Invalid request" when uploading metadata to Play Store with a locale it does not support HOT 1
- gym export_options : {method} resolves into empty string HOT 2
- Documentation for iOS screenshots on Xcode is outdated.
- TestFairy Action Fails with NoMethodError for key? Method on String
- Unable to ^C in response to 'Could not find fastlane ... Would you like to set fastlane up?'
- Match CLI Doc wrong? HOT 1
- [Sigh] Creating tvos provisioning profile fails when fetching devices. HOT 1
- `fastlane build_app` does not apply Flutter Flavor / Xcode Scheme HOT 1
- `fastlane match appstore` fails when generating tvOS profile HOT 2
- cert blocks sig 9
- You appear to have CocoaPods installed but it is not working. HOT 1
- exportArchive app requires a provisioning profile with the Access Wi-Fi Information, Hotspot, and Push Notifications features. HOT 1
- Match development with Appstore Connect API KEY fails due unexpected token error if there are more 18 bundle ids in matchfile
- number_of_commits run on GitHub action always returns 1 HOT 2
- Failing run via Bundler: `ensure in take_off': uninitialized constant FastlaneCore::UpdateChecker (NameError) HOT 5
- [Regression] uninitialized constant Fastlane::OpenStruct (NameError) with release 2.220.0 HOT 9
- [match] undefined local variable or method `profile` when running match with `output_path` HOT 5
- Fastlane is not reading macros from Package.Swift (SPM)
- fastlane sigh download_all and "Error parsing provisioning profile at path..."
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.