@@ -10,32 +10,6 @@ var pkg = require("../../package.json");
1010
1111var utils = require ( "../utils" ) ;
1212
13- var exec = function ( command , options ) {
14-
15- var deferred = Q . defer ( ) ;
16- var childProcess ;
17-
18- var args = Array . prototype . slice . call ( arguments , 0 ) ;
19- args . push ( function ( err , stdout , stderr ) {
20- if ( err ) {
21- err . message += command + ' (exited with error code ' + err . code + ')' ;
22- err . stdout = stdout ;
23- err . stderr = stderr ;
24- deferred . reject ( err ) ;
25- }
26- else {
27- deferred . resolve ( {
28- childProcess : childProcess ,
29- stdout : stdout ,
30- stderr : stderr
31- } ) ;
32- }
33- } ) ;
34-
35- childProcess = child_process . exec . apply ( child_process , args ) ;
36-
37- return deferred . promise ;
38- }
3913
4014var Addon = function ( _rootPath , options ) {
4115 this . root = _rootPath ;
@@ -167,7 +141,9 @@ var Addon = function(_rootPath, options) {
167141 return Q . nfcall ( fs . unlink , output ) . fail ( function ( ) {
168142 return Q ( ) ;
169143 } ) . then ( function ( ) {
170- return exec ( command )
144+ return utils . exec ( command , {
145+ env : process . env
146+ } )
171147 } ) . then ( function ( ) {
172148 logger . log ( "Finished" , that . infos . name , "optimization" ) ;
173149 return Q ( that ) ;
@@ -188,7 +164,10 @@ var Addon = function(_rootPath, options) {
188164 }
189165 }
190166 logger . log ( "Install dependencies for" , this . root ) ;
191- return exec ( "cd " + this . root + " && npm install ." ) . then ( function ( ) {
167+ return utils . exec ( "npm install ." , {
168+ cwd : this . root ,
169+ env : process . env
170+ } ) . then ( function ( ) {
192171 return Q ( that ) ;
193172 } ) ;
194173 } ;
0 commit comments