lib,src: fix spawnSync ignoring its 'env' option
authorJuanjo <juanjo@bitrock.com>
Tue, 14 Oct 2014 10:07:19 +0000 (12:07 +0200)
committerTrevor Norris <trev.norris@gmail.com>
Thu, 11 Dec 2014 18:31:06 +0000 (10:31 -0800)
PR-URL: https://github.com/joyent/node/pull/8546
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
lib/child_process.js
src/spawn_sync.cc

index c4345f9..e18b654 100644 (file)
@@ -1262,6 +1262,7 @@ function spawnSync(/*file, args, options*/) {
 
   options.file = opts.file;
   options.args = opts.args;
+  options.envPairs = opts.envPairs;
 
   if (options.killSignal)
     options.killSignal = lookupSignal(options.killSignal);
index 59de8d4..f13a9e9 100644 (file)
@@ -737,9 +737,9 @@ int SyncProcessRunner::ParseOptions(Local<Value> js_value) {
     r = CopyJsStringArray(js_env_pairs, &env_buffer_);
     if (r < 0)
       return r;
-    uv_process_options_.args = reinterpret_cast<char**>(env_buffer_);
-  }
 
+    uv_process_options_.env = reinterpret_cast<char**>(env_buffer_);
+  }
   Local<Value> js_uid = js_options->Get(env()->uid_string());
   if (IsSet(js_uid)) {
     if (!CheckRange<uv_uid_t>(js_uid))