Skip to content

Commit d8059ad

Browse files
committed
Resolve realpaths for targetBinLoc and pkgLoc in linkSelfDependencies
1 parent def4e54 commit d8059ad

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/package-linker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export default class PackageLinker {
4040
config: Config;
4141

4242
async linkSelfDependencies(pkg: Manifest, pkgLoc: string, targetBinLoc: string): Promise<void> {
43+
targetBinLoc = await fs.realpath(targetBinLoc);
44+
pkgLoc = await fs.realpath(pkgLoc);
4345
for (let [scriptName, scriptCmd] of entries(pkg.bin)) {
4446
let dest = path.join(targetBinLoc, scriptName);
4547
let src = path.join(pkgLoc, scriptCmd);

src/util/fs.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,7 @@ export async function symlink(src: string, dest: string): Promise<void> {
153153
await fsSymlink(src, dest, "junction");
154154
} else {
155155
// use relative paths otherwise which will be retained if the directory is moved
156-
let relative = src;
157-
if (path.isAbsolute(relative)) {
158-
relative = path.relative(path.dirname(dest), src);
159-
}
160-
156+
let relative = path.relative(path.dirname(dest), src);
161157
await fsSymlink(relative, dest);
162158
}
163159
} catch (err) {

0 commit comments

Comments
 (0)