Skip to content

Commit

Permalink
child_process_uv: fix test/simple/test-child-process-env
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 1, 2011
1 parent ef767a1 commit 624dd38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion lib/child_process_uv.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/process_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 624dd38

Please sign in to comment.