Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Don't update the NODE_PATH when updating the environment on launch - #12317

Merged
maxbrunsfeld merged 1 commit into
masterfrom
mb-ns-fix-launch-environment
Aug 4, 2016
Merged

maxbrunsfeld merged 1 commit into
masterfrom
mb-ns-fix-launch-environment

Conversation

@maxbrunsfeld

@maxbrunsfeld maxbrunsfeld commented Aug 3, 2016 •

Copy link
Copy Markdown
Contributor

Fixes #12313
Fixes atom/fuzzy-finder#205
Refs #12006 (solves same problem, but with a different approach)

Both NODE_ENV and NODE_PATH affect Atom's own behavior, so when loading environment variables from the main process, Atom needs to control these two variables explicitly.

@maxbrunsfeld
maxbrunsfeld merged commit 5bb7f08 into master Aug 4, 2016
@maxbrunsfeld
maxbrunsfeld deleted the mb-ns-fix-launch-environment branch August 4, 2016 00:00
@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

Thanks to @rahatarmanahmed for explaining the problem so clearly in #12006.

nathansobo pushed a commit that referenced this pull request Aug 4, 2016
Don't update the NODE_PATH when updating the environment on launch
nathansobo pushed a commit that referenced this pull request Aug 5, 2016
Don't update the NODE_PATH when updating the environment on launch
nathansobo pushed a commit that referenced this pull request Aug 5, 2016
Don't update the NODE_PATH when updating the environment on launch
joefitzgerald added a commit that referenced this pull request Aug 11, 2016
In Atom 1.7 and 1.8, the environment would be patched for users of the zsh shell on OS X. A whitelist of shells was established in #12317, which is extended here.
maxbrunsfeld pushed a commit that referenced this pull request Aug 11, 2016
…ssion

Fix Regression In #12317 For zsh and Patch Environment On OSX For Users Of fish
maxbrunsfeld pushed a commit that referenced this pull request Aug 16, 2016
…ssion

Fix Regression In #12317 For zsh and Patch Environment On OSX For Users Of fish
maxbrunsfeld pushed a commit that referenced this pull request Aug 16, 2016
…ssion

Fix Regression In #12317 For zsh and Patch Environment On OSX For Users Of fish
Comment thread src/update-process-env.js
}
}

function getEnvFromShell () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@maxbrunsfeld would you guys be interested in replacing this homegrown function with consistent-env. It supports both sync/async (no startup delay) and a wide variety of shells and is well tested and robust

@joefitzgerald joefitzgerald Sep 14, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👎 on the basis that it's not worth taking on additional dependencies to replace this small piece of code (which has since evolved to be more simple and address more shells and more platforms).

I write a lot of go code, so to draw inspiration from one of the creators of go:

"A little copying is better than a little dependency"
-Rob Pike

This is cogent, given parables like left-pad (not to suggest consistent-env is in any way like left-pad).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tell me if I'm wrong but I personally believe that a project should be focused and Atom's mission is to be a Text Editor not an env patcher. The reason I suggest this time and time again is that the current method is not reliable and we still have to patch PATH in all of the linter providers, if we can get it done in the core it'll make all those linter providers have one less dependency.

While you can copy a little to save a dependency, but if you keep doing this you'll end up with a bunch of bloatware that will be hard to maintain. and we can already see that Atom's maintaining power is being wasted into something that's already available as a module.

#12562 #12396 #11436 #12378 #12317 #12028 #11054 and more

@joefitzgerald joefitzgerald Sep 14, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think your last statements create false dichotomies. It is possible to make Atom a great text editor without taking on dependencies in all areas where you could depend on something. And having code in this specific area does not make Atom "bloatware".

If you believe the patching behavior should differ in some way you should file an issue substantiating the ways in which it should differ. The PATH patching you have to do for linters is a good example of a potential issue you could open. I don't currently understand why you need to do this, so opening an issue would enhance our shared understanding of your needs.

In general, further discussion of this in this line comment trail seems counter productive as the code has changed materially.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tell me if I'm wrong but I personally believe that a project should be focused and Atom's mission is to be a Text Editor not an env patcher.

By that line of reasoning, Atom shouldn't have any env patching code in it at all and we still shouldn't accept your module as a dependency.

This conversation is done, @steelbrain. I've discussed it with the team, we aren't going to be accepting your module as a dependency, stop suggesting it.

@nathansobo nathansobo Sep 14, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@steelbrain As someone who is ultimately responsible for maintaining this behavior in core, I find it easier to be able to browse to a specific chunk of code that performs this logic and immediately see what's going on rather than needing to dig it up in a dependency. It just doesn't seem complex enough to warrant it. That isn't always the case, but for this concern it is. It's a subjective call but that's my preference.

I would be very interested in accepting a specific PR addressing specific issues in the current code, however.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants