Skip to content

Commit

Permalink
Rework exit status capturing
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Nov 13, 2023
1 parent d44f007 commit dbaa79f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion example_app_generator/spec/support/default_preview_path
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require_file_stub 'config/environment' do
Rails.application.initialize!
end

exit if ENV['NO_ACTION_MAILER']
exit(0) if ENV['NO_ACTION_MAILER']
if ENV['DEFAULT_URL']
puts ActionMailer::Base.default_url_options[:host]
elsif defined?(::ActionMailer::Preview)
Expand All @@ -79,3 +79,4 @@ end
# This will force the loading of ActionMailer settings to ensure we do not
# accidentally set something we should not
ActionMailer::Base.smtp_settings
exit 0
12 changes: 10 additions & 2 deletions example_app_generator/spec/verify_mailer_preview_path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ def as_commandline(ops)

def capture_exec(*ops)
ops << { err: [:child, :out] }
io = IO.popen(ops)
lines = []

_process =
IO.popen(ops) do |io|
while (line = io.gets)
lines << line
end
end

# Necessary to ignore warnings from Rails code base
out = io.readlines
out = lines
.reject { |line| line =~ /warning: circular argument reference/ }
.reject { |line| line =~ /Gem::Specification#rubyforge_project=/ }
.reject { |line| line =~ /DEPRECATION WARNING/ }
Expand Down

0 comments on commit dbaa79f

Please sign in to comment.