Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

lifecycle: don’t warn about PATH for symlinked node #14374

Merged

Conversation

addaleax
Copy link
Contributor

Apply a fs.realpath() check to the found node executable to
mirror the fact that process.execPath is always a real path, too.

Fixes: #14372

/cc @zkat

@zkat zkat changed the base branch from latest to release-next October 21, 2016 20:34
@addaleax addaleax force-pushed the fix-symlinked-node-scripts-prepend-node-path branch from de7b489 to a66616b Compare October 21, 2016 21:01
@addaleax
Copy link
Contributor Author

Updated the PR a fixed patch, this should do better in CI

Apply a `fs.realpath()` check to the found `node` executable to
mirror the fact that `process.execPath` is always a real path
on modern Node.js versions, too.

Fixes: npm#14372
@addaleax addaleax force-pushed the fix-symlinked-node-scripts-prepend-node-path branch from a66616b to 63a5fa6 Compare October 21, 2016 21:03
checkPath({
withDirOfCurrentNode: 'extra-node',
prependNodePathSetting: 'warn-only',
symlinkNodeInsteadOfCopying: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it turns out this isn't going to work consistently across Windows platforms, depending on system configurations and stuff. Could we skip this entirely on Windows? (we have an isWindows utility for this)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the skip is probably better off inside checkPath itself)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zkat The only way to skip a test with node-tap’s API that I know of is setting skip: [true/string] in the test options, and that’s what I’ve seen in the wild so far. I totally agree that it would be better off inside checkPath, and if you know how to do that off the top of your head, feel free to show me or edit my changes yourself :)


test('make sure there is no warning with a symlinked node and warn-only detection', function (t) {
checkPath({
withDirOfCurrentNode: 'extra-node',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally made this a boolean+ for the sake of not adding more arguments, but since you're switching to a config object, do you mind making withDirOfCurrentNode a plain bool, and adding an extra config for the extra-node bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zkat done!

@zkat zkat added the review label Oct 21, 2016
Copy link
Contributor

@zkat zkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🐑 🎉

@zkat zkat merged commit eff46dd into npm:release-next Oct 21, 2016
@addaleax addaleax deleted the fix-symlinked-node-scripts-prepend-node-path branch October 21, 2016 23:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants