From 8f0eab6affe8afd408a0065531f83c6b3676f376 Mon Sep 17 00:00:00 2001 From: Sun Zheng'an Date: Wed, 3 Jun 2015 12:15:20 +0800 Subject: [PATCH] Replace environment variable named Path instead of PATH on Windows --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 61514d4..49e53b7 100644 --- a/index.js +++ b/index.js @@ -25,8 +25,9 @@ function shell(commands, options) { }, options) var pathToBin = path.join(process.cwd(), 'node_modules/.bin') - var PATH = pathToBin + path.delimiter + process.env.PATH - options.env = _.extend({}, process.env, {PATH: PATH}, options.env) + var pathName = /^win/.test(process.platform) ? 'Path' : 'PATH' + var newPath = pathToBin + path.delimiter + process.env[pathName] + options.env = _.extend(process.env, _.object([[pathName, newPath]]), options.env) var stream = through.obj(function (file, unused, done) { var self = this