bin/lessc: Make sure path.dirname gets passed strings #2853
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since nodejs/node@08085c49b6e, which will be part of Node.js v6.0, functions from the
path
core module (likedirname
) will require the input to be a string.Because
.sourceMapFullFilename
and.sourceMapInputFilename
in bin/lessc may beundefined
, default to passing'.'
topath.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', …)
.