Don't hang on things like named pipes and sockets.
    
        | author | Steve Losh <steve@stevelosh.com> | 
    
        | date | Wed, 31 Oct 2012 18:22:25 -0400 | 
    
    
        | parents | 81a3eeb15918 | 
    
        | children | 0f88e9f35bf1 | 
    
        | branches/tags | (none) | 
    
        | files | ffind | 
Changes
    
--- a/ffind	Fri Oct 26 11:38:52 2012 -0400
+++ b/ffind	Wed Oct 31 18:22:25 2012 -0400
@@ -444,7 +444,11 @@
                 return False
 
         if not options.binary:
-            with open(path) as f:
+            # We open in non-blocking mode so things like file-based sockets
+            # don't hang while waiting for their full kb.
+            # TODO: Ignore those altogether for the binary check?
+            fd = os.open(path, os.O_NONBLOCK)
+            with os.fdopen(fd) as f:
                 if '\0' in f.read(1024):
                     return False