Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Redirect `which` stdout and stderr to /dev/null #12

Closed
wants to merge 1 commit into from

2 participants

@rmascarenhas

kdialog, notify_send and osd_cat notifiers shell out calling the which
utility and redirecting standart output to /dev/null. However, when
which can't find a file in your $PATH, the error message is
written to standard error, causing it to be displayed when you call the
notify method.

This commit makes which redirect both its standard output and standard
error to /dev/null.

Renato Mascarenhas Redirect `which` stdout and stderr to /dev/null
kdialog, notify_send and osd_cat notifiers shell out calling the `which`
utility and redirecting standart output to /dev/null. However, when
`which` can't find a file in your $PATH, the error message is
written to standard error, causing it to be displayed when you call the
`notify` method.

This commit makes `which` redirect both its standard output and standard
error to /dev/null.
4605636
@fnando fnando closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 8, 2012
  1. Redirect `which` stdout and stderr to /dev/null

    Renato Mascarenhas authored
    kdialog, notify_send and osd_cat notifiers shell out calling the `which`
    utility and redirecting standart output to /dev/null. However, when
    `which` can't find a file in your $PATH, the error message is
    written to standard error, causing it to be displayed when you call the
    `notify` method.
    
    This commit makes `which` redirect both its standard output and standard
    error to /dev/null.
This page is out of date. Refresh to see the latest.
View
2  lib/notifier/kdialog.rb
@@ -3,7 +3,7 @@ module Kdialog
extend self
def supported?
- Notifier.os?(/(linux|freebsd)/) && `which kdialog > /dev/null` && $? == 0
+ Notifier.os?(/(linux|freebsd)/) && `which kdialog &> /dev/null` && $? == 0
end
def notify(options)
View
2  lib/notifier/notify_send.rb
@@ -3,7 +3,7 @@ module NotifySend
extend self
def supported?
- Notifier.os?(/(linux|freebsd)/) && `which notify-send > /dev/null` && $? == 0
+ Notifier.os?(/(linux|freebsd)/) && `which notify-send &> /dev/null` && $? == 0
end
def notify(options)
View
2  lib/notifier/osd_cat.rb
@@ -3,7 +3,7 @@ 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` && $? == 0
end
def notify(options)
Something went wrong with that request. Please try again.