Skip to content

Commit

Permalink
Merge pull request #1735 from Glavin001/bugfix/1728
Browse files Browse the repository at this point in the history
Fixes #1728. Remove Shell-Env from Executable, use Atom's process.env instead
  • Loading branch information
Glavin001 authored Jun 22, 2017
2 parents bfef1d3 + 75e0992 commit 11a385f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Next
- ...
- Fixes [#1728](https://github.com/Glavin001/atom-beautify/issues/1728). Remove Shell-Env from Executable, use Atom's process.env instead. See [#1735](https://github.com/Glavin001/atom-beautify/pull/1735).

# v0.30.2 (2017-06-20)
- Fixes [#1030](https://github.com/Glavin001/atom-beautify/issues/1030). Add support for alpha versions of autopep8
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
"winston": "2.3.1",
"yaml-front-matter": "3.4.0"
},
"activationHooks": [
"core:loaded-shell-environment"
],
"activationCommands": {
"atom-workspace": [
"atom-beautify:help-debug-editor",
Expand Down Expand Up @@ -433,4 +436,4 @@
"prettydiff"
]
}
}
}
4 changes: 4 additions & 0 deletions spec/beautify-languages-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ beautifier = new Beautifiers()
fs = require "fs"
path = require "path"
JsDiff = require('diff')
shellEnv = require('shell-env')

# Fix https://discuss.atom.io/t/specs-do-not-load-shell-environment-variables-activationhooks-core-loaded-shell-environment/44199
process.env = shellEnv.sync()

# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
Expand Down
13 changes: 4 additions & 9 deletions src/beautifiers/executable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ which = require('which')
spawn = require('child_process').spawn
path = require('path')
semver = require('semver')
shellEnv = require('shell-env')
os = require('os')
fs = require('fs')

Expand Down Expand Up @@ -324,15 +323,11 @@ class Executable

@_envCache = null
shellEnv: () ->
@constructor.shellEnv()
env = @constructor.shellEnv()
@debug("env", env)
return env
@shellEnv: () ->
if @_envCache
return Promise.resolve(@_envCache)
else
shellEnv()
.then((env) =>
@_envCache = env
)
Promise.resolve(process.env)

###
Like the unix which utility.
Expand Down

0 comments on commit 11a385f

Please sign in to comment.