Skip to content

Commit b9367d3

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 3ed3458 commit b9367d3

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
@@ -98,8 +98,15 @@ function configure (gyp, argv, callback) {
9898

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

101-
fs.unlink(symlinkDestination, function () {
102-
fs.symlink(python, symlinkDestination, function () {})
101+
fs.unlink(symlinkDestination, function (err) {
102+
if (err && err.code !== 'ENOENT') {
103+
log.warn('python symlink', 'error when attempting to remove existing symlink\n', err)
104+
}
105+
fs.symlink(python, symlinkDestination, function (err) {
106+
if (err) {
107+
log.warn('python symlink', 'error when attempting to create Python symlink\n', err)
108+
}
109+
})
103110
})
104111
}
105112

0 commit comments

Comments
 (0)