Skip to content

Instantly share code, notes, and snippets.

@s-shin
Last active January 23, 2016 05:36
Show Gist options
  • Save s-shin/d5f59107fc8abc8d1e7f to your computer and use it in GitHub Desktop.
Save s-shin/d5f59107fc8abc8d1e7f to your computer and use it in GitHub Desktop.
An example to overwrite environment variables in atom editor.
{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