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

bin/lessc: Make sure path.dirname gets passed strings #2853

Merged
merged 1 commit into from
Mar 27, 2016

Conversation

addaleax
Copy link
Contributor

Since nodejs/node@08085c49b6e, which will be part of Node.js v6.0, functions from the path core module (like dirname) will require the input to be a string.

Because .sourceMapFullFilename and .sourceMapInputFilename in bin/lessc may be undefined, default to passing '.' to path.dirname instead. (In Node ≤ v5.x, path.dirname(undefined) === '.'.)

Disclosure: I basically don’t know anything about less internals. What I know is that this fixes my build; there’s a good chance that there is a more appropriate solution for this problem. I also have no idea where a test for this particular problem would go, but since this issue can be reproduced by simply running lessc <input>, I don’t know if that’s even necessary.

Also, this line suppresses all uncaught exceptions, which made debugging kinda hard. Again, I don’t know whether that’s the best way for less, but I’d suggest adding an explicit handler via process.on('uncaughtException', …).

Since nodejs/node@08085c49b6e, which will be part of Node.js v6.0,
functions from the `path` core module (like `dirname`) will require
the input to be a string.

Because `.sourceMapFullFilename` and `.sourceMapInputFilename` in
bin/lessc may be `undefined`, default to passing `'.'` to
`path.dirname` instead.
@seven-phases-max
Copy link
Member

Merging (I guess this can't hurt at least... Though I'm in doubts if it should be explicit cwd string instead of . (which probably could have some weird side-effects in edge cases).

@seven-phases-max seven-phases-max merged commit 5bf6329 into less:master Mar 27, 2016
@seven-phases-max
Copy link
Member

Thanks!

@addaleax addaleax deleted the path-dirname-string-input branch March 27, 2016 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants