Situation: when I have a directory "/tmp/a" that has a symlink and I try to copy this directory to "/tmp/b" which has the same symlink copySync fails.
✗ ls -lah /tmp/a
total 0
drwxr-xr-x 3 l wheel 96B 1 Jul 09:22 .
drwxrwxrwt 17 root wheel 544B 1 Jul 09:23 ..
lrwxr-xr-x 1 l wheel 14B 1 Jul 09:19 symlink-to-real-file -> /tmp/real-file
✗ ls -lah /tmp/b
total 0
drwxr-xr-x 3 l wheel 96B 1 Jul 09:25 .
drwxrwxrwt 17 root wheel 544B 1 Jul 09:23 ..
lrwxr-xr-x 1 l wheel 14B 1 Jul 09:20 symlink-to-real-file -> /tmp/real-file
The code:
copySync('/tmp/a', '/tmp/b');
Throws:
/Volumes/workplace/TestBug/node_modules/fs-extra/lib/copy/copy-sync.js:143
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
^
Error: Cannot copy '/tmp/real-file' to a subdirectory of itself, '/tmp/real-file'.
The same call succeeds if we have a file instead of a symlink.
fs-extra
version: fs-extra@11.2.0Situation: when I have a directory "/tmp/a" that has a symlink and I try to copy this directory to "/tmp/b" which has the same symlink
copySync
fails.The code:
Throws:
The same call succeeds if we have a file instead of a symlink.