Browse Source

child_process_uv: fix test/simple/test-child-process-env

v0.7.4-release
Ryan Dahl 13 years ago
parent
commit
624dd38d89
  1. 1
      Makefile
  2. 10
      lib/child_process_uv.js
  3. 2
      src/process_wrap.cc

1
Makefile

@ -238,6 +238,7 @@ UVTEST += simple/test-child-process-exit-code
UVTEST += simple/test-child-process-buffering
UVTEST += simple/test-child-process-exec-cwd
UVTEST += simple/test-child-process-cwd
UVTEST += simple/test-child-process-env
test-uv: all

10
lib/child_process_uv.js

@ -172,10 +172,18 @@ var spawn = exports.spawn = function(file, args, options) {
var args = args ? args.slice(0) : [];
args.unshift(file);
var env = (options ? options.env : null) || process.env;
var envPairs = [];
var keys = Object.keys(env);
for (var key in env) {
envPairs.push(key + '=' + env[key]);
}
child.spawn({
file: file,
args: args,
cwd: options ? options.cwd : null
cwd: options ? options.cwd : null,
envPairs: envPairs
});
return child;

2
src/process_wrap.cc

@ -113,7 +113,7 @@ class ProcessWrap : public HandleWrap {
}
// options.env
Local<Value> env_v = js_options->Get(String::New("env"));
Local<Value> env_v = js_options->Get(String::New("envPairs"));
if (!env_v.IsEmpty() && env_v->IsArray()) {
Local<Array> env = Local<Array>::Cast(env_v);
int envc = env->Length();

Loading…
Cancel
Save