Skip to content

Commit

Permalink
Merge pull request #64 from sunaku/unix_socket
Browse files Browse the repository at this point in the history
ENXIO raised when hashing UNIX domain socket file
  • Loading branch information
thibaudgg committed Oct 3, 2012
2 parents ed180c6 + e5152b0 commit 80de26c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/listen/directory_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def insert_sha1_checksum(path)
#
def sha1_checksum(path)
Digest::SHA1.file(path).to_s
rescue Errno::EACCES, Errno::ENOENT
rescue Errno::EACCES, Errno::ENOENT, Errno::ENXIO
nil
end

Expand Down
10 changes: 10 additions & 0 deletions spec/listen/directory_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,16 @@
end
end

context 'within a directory containing a unix domain socket file' do
it 'does not raise an exception when hashing a unix domain socket file' do
fixtures do |path|
require 'socket'
UNIXServer.new('unix_domain_socket.sock')
lambda { changes(path){} }.should_not raise_error(Errno::ENXIO)
end
end
end

context 'with symlinks', :unless => windows? do
it 'looks at symlinks not their targets' do
fixtures do |path|
Expand Down

0 comments on commit 80de26c

Please sign in to comment.