mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Patch process.env on startup
This commit is contained in:
@@ -362,3 +362,16 @@ describe "AtomEnvironment", ->
|
||||
|
||||
version = '1.7.0-dev-5340c91'
|
||||
expect(atom.getReleaseChannel()).toBe 'dev'
|
||||
|
||||
describe "environment patching", ->
|
||||
it "patches process.env on startup", ->
|
||||
configDirPath = temp.mkdirSync()
|
||||
fakeDocument = {
|
||||
addEventListener: ->
|
||||
removeEventListener: ->
|
||||
head: document.createElement('head')
|
||||
body: document.createElement('body')
|
||||
}
|
||||
atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate, window, document: fakeDocument})
|
||||
|
||||
expect(process.env).toEqual atomEnvironment.project.getEnv()
|
||||
|
||||
@@ -230,6 +230,10 @@ class AtomEnvironment extends Model
|
||||
|
||||
checkPortableHomeWritable()
|
||||
|
||||
# Patch the `process.env` on startup to fix the problem first documented
|
||||
# in #4126
|
||||
process.env = @project.getEnv()
|
||||
|
||||
attachSaveStateListeners: ->
|
||||
saveState = => @saveState({isUnloading: false}) unless @unloaded
|
||||
debouncedSaveState = _.debounce(saveState, @saveStateDebounceInterval)
|
||||
|
||||
Reference in New Issue
Block a user