Skip to content

ts-lce fails when there are broken symbolic links #118

@JohT

Description

@JohT

Hi 👋,

i've encountered an edge case while running npx --yes @jqassistant/ts-lce@1.2.0:
The command will fail in project.utils.ts when there is a broken symbolic link.

I guess this is rather rare and therefore most probably negligible.

Error Message

node:fs:1658
  const stats = binding.stat(
                        ^

Error: ENOENT: no such file or directory, stat '~/Repositories/git/temp/softlink-to-non-existing-directory'
    at Object.statSync (node:fs:1658:25)
    at ~/.npm/_npx/b0d7d4223fca6850/node_modules/@jqassistant/ts-lce/dist/src/core/utils/project.utils.js:44:38
    at Array.forEach (<anonymous>)
    at ProjectUtils.determineProjects (~/.npm/_npx/b0d7d4223fca6850/node_modules/@jqassistant/ts-lce/dist/src/core/utils/project.utils.js:42:55)
    at processProjects (~/.npm/_npx/b0d7d4223fca6850/node_modules/@jqassistant/ts-lce/dist/src/core/extractor.js:77:57)
    at processProjectsAndOutputResult (~/.npm/_npx/b0d7d4223fca6850/node_modules/@jqassistant/ts-lce/dist/src/core/extractor.js:44:37)
    at Object.<anonymous> (~/.npm/_npx/b0d7d4223fca6850/node_modules/@jqassistant/ts-lce/dist/src/main.js:31:48)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '~/Repositories/git/temp/softlink-to-non-existing-directory'
}

Node.js v20.14.0

Reproduce

The error can be reproduced with these commands (bash/zsh shell):

mkdir -p temp
cd temp
ln -s /non-existing soft-symbolic-link-to-non-existing-directory
npx --yes @jqassistant/ts-lce@1.2.0

Thanks and keep on writing great tools like this 👍.

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