You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the destination of the ln command is an existing directory, shelljs will fail stating that the Destination file exists.
However, according to tests in the mentioned environments, the correct behaviour would be to put a symlink with the source's name into that destination directory.
Example ShellJS command to reproduce the error:
The following commands fail, they should instead create a symlink to /some/source/path as ./path.
shelljs.ln('-s','/some/source/path','.')
or
shx ln -s /some/source/path .
The text was updated successfully, but these errors were encountered:
It looks like ln should behave like cp: if the last argument is an existing-directory, then the link should be created inside that directory and the link name should default to the name of the thing it points to.
Concretely, it should look like this:
$ ln -s path/to/file.txt thisFolderExists
# there's a link named thisFolderExists/file.txt
$ ln -s path/to/file.txt thisDoesNotExist
# there's a link named 'thisDoesNotExist', which points to 'path/to/file.txt'
$ ln -s path/to/file.txt thisRegularFileExists
ln: failed to create symbolic link 'thisRegularFileExists': File exists
One thing to mention though (which I figured out while implementing the attached pull request): The name in fact does not default to the source pointed to, but the basename you provided.
By Example:
Assume the following directory tree:
a/
└── b/
└── c/
If we are in c/ and run ln -s . ../.., we'd expect to get a symlink named c, located inside a, pointing to c.
This is, in fact, not the case. The command will fail with ln: failed to create symbolic link '../../.': File exists.
That leads me to assume that the default name is actually the basename from the user-provided source path.
Node version:
9.10.1
ShellJS version:
0.7.8
Operating system:
Tested on macOS 10.13.2 and Ubuntu 14.04.5 LTS
Description of the bug:
If the destination of the
ln
command is an existing directory,shelljs
will fail stating that theDestination file exists
.However, according to tests in the mentioned environments, the correct behaviour would be to put a symlink with the source's name into that destination directory.
Example ShellJS command to reproduce the error:
The following commands fail, they should instead create a symlink to
/some/source/path
as./path
.or
shx ln -s /some/source/path .
The text was updated successfully, but these errors were encountered: