Skip to content

Commit

Permalink
Ignore Launchy::CommandNotFoundError on deliver
Browse files Browse the repository at this point in the history
When Launchy runs dry run mode, its runner will detect executable command.
Ref: https://github.com/copiousfreetime/launchy/blob/v2.4.3/lib/launchy/detect/runner.rb#L58

It makes sense for Launchy. So letter_opener_web should avoid this error.
  • Loading branch information
tricknotes committed Jan 28, 2018
1 parent 35c77b3 commit 661ef92
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/letter_opener_web/delivery_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
module LetterOpenerWeb
class DeliveryMethod < LetterOpener::DeliveryMethod
def deliver!(mail)
original = ENV['LAUNCHY_DRY_RUN']
ENV['LAUNCHY_DRY_RUN'] = 'true'

super
ENV['LAUNCHY_DRY_RUN'] = 'false'
rescue Launchy::CommandNotFoundError # rubocop:disable HandleExceptions
# Ignore for non-executable Launchy environment.
ensure
ENV['LAUNCHY_DRY_RUN'] = original
end
end
end

0 comments on commit 661ef92

Please sign in to comment.