lib/notifier/osd_cat.rb in notifier-0.5.2 vs lib/notifier/osd_cat.rb in notifier-1.0.0

- old
+ new

@@ -1,11 +1,15 @@ +# frozen_string_literal: true + module Notifier module OsdCat extend self def supported? - Notifier.os?(/(linux|freebsd)/) && `which osd_cat > /dev/null` && $? == 0 + Notifier.os?(/(linux|freebsd)/) && + `which osd_cat > /dev/null` && + $CHILD_STATUS == 0 end def notify(options) color = options.fetch(:color, "white").to_s @@ -16,14 +20,14 @@ "--pos", "top", "--offset", "10", "--align", "center", "--font", "-bitstream-bitstream charter-bold-r-*-*-*-350-*-*-*-*-*-*", "--delay", "5", - "--outline", "4", + "--outline", "4" ] Thread.new do - Open3.popen3(*command) do |stdin, stdout, stderr| + Open3.popen3(*command) do |stdin, _stdout, _stderr| stdin.puts options[:message] stdin.close end end.join end