Skip to content

Directory symlink results in EISDIR failure #196

Closed
@ConradHughes

Description

@ConradHughes

Whenever my source tree contains a symlink to a directory, pretty-quick fails after trying to read a directory as if it were a file:

$ mkdir foo
$ ln -s foo bar
$ npx pretty-quick --staged --check
...
Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:741:18)
    at LineByLine._readChunk (file:///.../node_modules/prettier/index.mjs:9439:27)
    at LineByLine.next (file:///.../node_modules/prettier/index.mjs:9465:28)
    at getInterpreter (file:///.../node_modules/prettier/index.mjs:17230:29)
    at getLanguageByInterpreter (file:///.../node_modules/prettier/index.mjs:17271:23)
    at inferParser (file:///.../node_modules/prettier/index.mjs:17286:192)
    at getParser (file:///.../node_modules/prettier/index.mjs:17317:55)
    at async getFileInfo (file:///.../node_modules/prettier/index.mjs:17305:22)
    at async /.../node_modules/pretty-quick/lib/isSupportedExtension.js:8:22
    at async Promise.all (index 14) {
  errno: -21,
  code: 'EISDIR',
  syscall: 'read'

Running strace --follow-forks --output-separately -o fail.log npx pretty-quick ... helped pin down the offending syscall (grep the log files for = -1 EISDIR).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions