mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-07 14:38:32 -05:00
fix(fs.hard-link-dir): don't try to hard link a directory to itself
This commit is contained in:
5
.changeset/seven-apples-flash.md
Normal file
5
.changeset/seven-apples-flash.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/fs.hard-link-dir": patch
|
||||
---
|
||||
|
||||
Don't try to hard link the source directory to itself.
|
||||
@@ -2,6 +2,9 @@ import path from 'path'
|
||||
import { promises as fs } from 'fs'
|
||||
|
||||
export async function hardLinkDir (src: string, destDirs: string[]) {
|
||||
if (destDirs.length === 0) return
|
||||
// Don't try to hard link the source directory to itself
|
||||
destDirs = destDirs.filter((destDir) => path.relative(destDir, src) !== '')
|
||||
const files = await fs.readdir(src)
|
||||
await Promise.all(
|
||||
files.map(async (file) => {
|
||||
|
||||
Reference in New Issue
Block a user