Browse files

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

  • Loading branch information...
1 parent ef767a1 commit 624dd38d898d9a69a60320010d8598823ab1f603 @ry ry committed Jul 31, 2011
Showing with 11 additions and 2 deletions.
  1. +1 −0 Makefile
  2. +9 −1 lib/child_process_uv.js
  3. +1 −1 src/process_wrap.cc
View
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
View
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;
View
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();

0 comments on commit 624dd38

Please sign in to comment.