Last active
January 23, 2016 05:36
-
-
Save s-shin/d5f59107fc8abc8d1e7f to your computer and use it in GitHub Desktop.
An example to overwrite environment variables in atom editor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{spawnSync} = require "child_process" | |
do -> | |
ENV = [ | |
"PATH" | |
"GOPATH" | |
] | |
result = spawnSync process.env.SHELL, ["-lc", "printenv"] | |
envLines = result.stdout.toString().split("\n") | |
for line in envLines | |
[name, value] = line.split(/[=](.+)/) | |
process.env[name] = value if name in ENV | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment