-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fixed linter on windows machines #22
Conversation
@@ -31,7 +31,9 @@ module.exports = Helpers = | |||
else | |||
resolve(data.stderr.join('')) | |||
if isNodeExecutable | |||
spawnedProcess = new BufferedNodeProcess({command, args, stdout, stderr, exit}) | |||
options.env = JSON.parse(JSON.stringify(process.env)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about options.env ?= Object.create(process.env)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that in the bufferedNodeProcess code, but for some reason, Object.create(process.env) returns an empty object when I use it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't return an empty object, it just moves stuff to the prototype. You might not see it in the debugger at top level but it's still there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow can't believe I didn't know that... So I looked more into Object.create and an interesting thing about it is that the properties created are not writable, enumerable or configurable by default
I am so glad that you found the key which was causing the problem. Thanks 👏 |
LGTM, all I need now is some users confirming that this works. I'll post this in the jshint thread. |
Thanks again 👏 |
Fixed linter on windows machines
Passing in custom options without process.env.OS to fix issues on windows machines.
I'm creating a copy of the process.env by using JSON.parse(JSON.stringify(process.env)), which is a bit ugly. I can change that if you know of a cleaner way to do it.