Skip to content

Loading…

Improve Emacs detection #315

Merged
merged 1 commit into from

3 participants

@maio
Guard member

for some reason emacsclient sometimes doesn't return result of
evaluation so it's safer to base decision on non-zero exit value.

@maio maio Improve Emacs detection
for some reason emacsclient sometimes doesn't return result of
evaluation so it's safer to base decision on non-zero exit value.
5fb0862
@travisbot

This pull request passes (merged 5fb0862 into 7965e7d).

@netzpirat netzpirat merged commit bf333a0 into guard:master

1 check passed

Details default The Travis build passed
@netzpirat

Thanks for the pull request. I'm not an Emacs user myself, but I've installed Emacs to see how it works and it looks nice. I'm not sure if the availability check should be more simplified, because currently you have to run Emacs in server mode before you start Guard. I think it may be enough to test if emacsclient is in the path, just to test if it's possible to send notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 5, 2012
  1. @maio

    Improve Emacs detection

    maio committed
    for some reason emacsclient sometimes doesn't return result of
    evaluation so it's safer to base decision on non-zero exit value.
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/guard/notifiers/emacs.rb
View
8 lib/guard/notifiers/emacs.rb
@@ -25,12 +25,12 @@ module Emacs
# @return [Boolean] the availability status
#
def available?(silent = false)
- result = `#{DEFAULTS[:client]} --eval '1' 2> /dev/null || echo 0`
+ result = `#{DEFAULTS[:client]} --eval '1' 2> /dev/null || echo 'N/A'`
- if result.chomp! == "1"
- true
- else
+ if result.chomp! == "N/A"
false
+ else
+ true
end
end
Something went wrong with that request. Please try again.