Skip to content

Added additional error checking to FileWatch::Tail#_open_file #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nealpatel-work
Copy link

I fixed a bug I encountered.

FileWatch tried to stat files located in directories without the +x flag. This caused FileWatch to raise an error (Errno::EACCES), which it shouldn't do (regardless of what permissions are set on the file).

@jsvd
Copy link
Collaborator

jsvd commented Feb 16, 2015

I agree that this is a poor error message, but not sure if adding the string "or stat" helps users understand that the problem comes from the directory's permissions.
maybe, on exception, check them?

begin
   # ...
rescue
   # ..
   dir = File.dirname("dir/file")
   unless File.executable?(dir) && File.writable?(dir) do
     @logger.error "Directory has permission issues #{File.stat(dir).inspect}"
   end
 end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants