Scandal doesn't handle file permission issues
izuzak opened this issue · 0 comments
Derived from: atom/find-and-replace#197
When scandal attempts to read file contents, it just assumes that it has permission to do so here:
scandal/src/chunked-line-reader.coffee
Line 40 in 9fbf4a9
However, in case the current process doesn't have read permissions for the file, fd
is not initialized and an EACCESS
exception is raised. Because of that, scandal throws a Bad argument
error here:
scandal/src/chunked-line-reader.coffee
Line 81 in 9fbf4a9
If that finally block checks to see if fd
was initialized, then the EACCESS
error is propagated instead of the Bad argument
error (expected).
What would be a good way to handle those EACCESS
errors? Would just catching them be it, or is there something more involved (e.g. if some other part of scandal is waiting to hear back when the file was completely read)?
cc @benogle