Skip to content

Commit 6086960

Browse files
committed
lib: log any errors when creating Python symlink
Warn users about errors, but continue on in case the user does happen to have new enough Python on their PATH. (The symlinks are only meant to fix an issue in a corner case, where the user told `node-gyp` where new enough Python is, but it's not the first `python3` on their PATH. We should not introduce a new potential failure mode to all users when fixing this bug. So no hard errors during the symlink process.)
1 parent 9c40508 commit 6086960

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/configure.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,15 @@ function configure (gyp, argv, callback) {
9595

9696
log.verbose('python symlink', `creating symlink to "${python}" at "${symlinkDestination}"`)
9797

98-
fs.unlink(symlinkDestination, function () {
99-
fs.symlink(python, symlinkDestination, function () {})
98+
fs.unlink(symlinkDestination, function (err) {
99+
if (err && err.code !== 'ENOENT') {
100+
log.warn('python symlink', 'error when attempting to remove existing symlink\n', err)
101+
}
102+
fs.symlink(python, symlinkDestination, function (err) {
103+
if (err) {
104+
log.warn('python symlink', 'error when attempting to create Python symlink\n', err)
105+
}
106+
})
100107
})
101108
}
102109

0 commit comments

Comments
 (0)