Skip to content

Commit

Permalink
simplify and improve preferLocal option
Browse files Browse the repository at this point in the history
fixes #109
  • Loading branch information
sindresorhus committed Sep 25, 2016
1 parent d571099 commit 88e6f6e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
@@ -1,7 +1,5 @@
sudo: false
language: node_js
node_js:
- '5'
- '6'
- '4'
- '0.12'
- '0.10'
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -31,7 +31,7 @@
],
"dependencies": {
"chalk": "^1.0.0",
"npm-run-path": "^1.0.0",
"npm-run-path": "^2.0.0",
"object-assign": "^4.0.0"
},
"devDependencies": {
Expand Down
4 changes: 1 addition & 3 deletions tasks/shell.js
Expand Up @@ -2,7 +2,6 @@
var exec = require('child_process').exec;
var chalk = require('chalk');
var npmRunPath = require('npm-run-path');
var objectAssign = require('object-assign');

module.exports = function (grunt) {
grunt.registerMultiTask('shell', 'Run shell commands', function () {
Expand All @@ -28,8 +27,7 @@ module.exports = function (grunt) {
cmd = grunt.template.process(typeof cmd === 'function' ? cmd.apply(grunt, arguments) : cmd);

if (opts.preferLocal === true) {
opts.execOptions.env = opts.execOptions.env || objectAssign({}, process.env);
opts.execOptions.env.PATH = npmRunPath({path: opts.execOptions.env.PATH});
opts.execOptions.env = npmRunPath.env({env: opts.execOptions.env || process.env});
}

var cp = exec(cmd, opts.execOptions, function (err, stdout, stderr) {
Expand Down

0 comments on commit 88e6f6e

Please sign in to comment.