Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/354 #355

Closed
wants to merge 3 commits into from
Closed

Fix/354 #355

wants to merge 3 commits into from

Conversation

Nysosis
Copy link

@Nysosis Nysosis commented Nov 6, 2018

Fixes #354

Ensures we're using native path separator to build paths via the path module

}

function exists (basedir, file) {
try {
require.resolve(`${basedir}/${file}`)
require.resolve(path.join(basedir, file))
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is necessary since require uses the module syntax and not regular paths, meaning it should always be forward slashes. See nodejs/node#6049 (comment)

@@ -158,12 +159,12 @@ function getVersion (moduleBaseDir) {
}

function filename (plugin) {
return [plugin.name, plugin.file].filter(val => val).join('/')
return path.join.apply(path, [plugin.name, plugin.file].filter(val => val))
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to convert all platform specific separators to forward slashes instead to avoid any incompatibility with require. This would also allow plugins to use simple forward slashes.

@@ -132,7 +134,7 @@ function getAddress (link) {
module.exports = [
{
name: 'amqp10',
file: 'lib/sender_link.js',
file: path.join('lib', 'sender_link.js'),
Copy link
Member

Choose a reason for hiding this comment

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

The conversion should be done in the instrumenter to avoid having to do this in plugins. This also applies to all other plugins.

@Nysosis
Copy link
Author

Nysosis commented Nov 7, 2018

@rochdev Yup, all your comments make sense, I'll take another look into it, and try and figure out a better solution. A quick dig last night showed me that something going on in the require-in-the-middle module is what is causing

if (this._names.indexOf(moduleName) === -1) {
to have different pathing separators between what's in this._names and in moduleName (and the cause of the issue on windows)

@rochdev
Copy link
Member

rochdev commented Nov 14, 2018

@Nysosis I've created #374 which adds official support for Windows, fixing this issue at the same time.

@Nysosis
Copy link
Author

Nysosis commented Nov 15, 2018

@rochdev Thanks! I'll close this PR down

@Nysosis Nysosis closed this Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants