Skip to content

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

Open
nealpatel-work wants to merge 1 commit into
jordansissel:masterfrom
nealpatel-work:master
Open

Added additional error checking to FileWatch::Tail#_open_file#35
nealpatel-work wants to merge 1 commit into
jordansissel:masterfrom
nealpatel-work:master

Conversation

@nealpatel-work
Copy link
Copy Markdown

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
Copy Markdown
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