Repository navigation
Fix Regression In #12317 For zsh and Patch Environment On OSX For Users Of fish - #12396
Conversation
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.
| } | ||
|
|
||
| return false | ||
| } |
There was a problem hiding this comment.
I would suggest two fairly minor stylistic changes to this shellShouldBePatched function:
- I think it should take a shell as an argument and return a boolean, rather than internally getting the shell from
process.envand returning either a string ornull. - I think the name is a bit odd; it makes it sound like the shell itself is getting patched. Maybe
canGetLoginEnvFromShell(shellPath)?
I think this would make the function a little simpler to test, since you wouldn't have to overwrite process.env.SHELL. You wouldn't need a loop; you could just do:
expect(canGetLoginEnvFromShell('/bin/bash')).toBe(true)
expect(canGetLoginEnvFromShell('/some/other/bash')).toBe(true)
expect(canGetLoginEnvFromShell('/usr/local/bin/fish')).toBe(true)
expect(canGetLoginEnvFromShell('/bin/give-me-cash')).toBe(false)
expect(canGetLoginEnvFromShell('/usr/bin/birthday-bash')).toBe(false)| }) | ||
|
|
||
| describe('shells on osx', function () { | ||
| it('envShouldBePatched() returns the shell when the shell should be patched', function () { |
There was a problem hiding this comment.
Could you move the function name up into the describe, so that the it sentences read a bit better?
describe('envShouldBePatched()', function () {
it('returns true for shells that ', function () {
// ...
})There was a problem hiding this comment.
The envShouldBePatched name is a little clearer, but I think it'd be best to make it clear that the return value depends on the shell, not the env. Also, the env is completely replaced (except for the 3 'special' variables), so emphasizing the 'patching' doesn't seem entirely necessary.
How about shouldGetEnvFromShell?
|
Great; Thanks for fixing this regression @joefitzgerald! |
…ssion Fix Regression In #12317 For zsh and Patch Environment On OSX For Users Of fish
…ssion Fix Regression In #12317 For zsh and Patch Environment On OSX For Users Of fish
In Atom 1.7 and 1.8, the environment would be patched for users of the zsh shell on OS X, who launched Atom from the Dock / Finder / Spotlight. A whitelist of shells was established in #12317, which is extended here to include zsh and fish.
Tested with built-in zsh, homebrew installed zsh, and homebrew installed fish.