vmware-archive / scripted

The Scripted code editor
Eclipse Public License 1.0
1.56k stars 166 forks source link

Allow exec 'env' to inherit from 'process.env' #230

Closed scothis closed 11 years ago

scothis commented 11 years ago

When executing a command Node uses process.env by default. If the 'env' option is specified, Node assumes that the complete environment is provided.

As Scripted exec configurations are declarative, and it's practically impossible to correctly configure an environment declaratively, Scripted should mix the declared env vars into the 'process.env'.

For example, this is my .scripted config:

"exec": {
  "onKeys": {
    "cmd+b": {
      "cmd": "npm test",
      "cwd": "${projectDir}",
      "name": "Test Project",
      "env": {
        "BUSTER_TEST_OPT": "--color none --reporter specification"
      }
    }
  }
}

Before this patch, Node is unable to spawn the child process because the environment is incomplete. After this patch, it's able to run the command with 'process.env' as the environment, augmented with 'BUSTER_TEST_OPT'.

aclement commented 11 years ago

Kris - can you look at merging this.