Skip to content
Browse files

Fixed using which for better internal usage. Fixes #43

  • Loading branch information...
1 parent 545e0d9 commit b7614dc64055ee5353fda3fe7c55d491bc455658 @davglass davglass committed
Showing with 16 additions and 8 deletions.
  1. +4 −2 lib/builder.js
  2. +1 −1 lib/module.js
  3. +4 −0 lib/util.js
  4. +4 −3 lib/walk.js
  5. +3 −2 lib/watch.js
View
6 lib/builder.js
@@ -6,9 +6,9 @@ http://yuilibrary.com/license/
var path = require('path'),
log = require('./log'),
noop = function () {},
+ util = require('./util'),
shifter = require('./index'),
timer = require('timethat'),
- which = require('which').sync,
spawn = require('child_process').spawn,
Stack = require('./stack').Stack,
pack = require('./pack'),
@@ -54,7 +54,9 @@ var prebuild = function (jobs, options, callback) {
if (options.istanbul) {
args.push('--istanbul');
}
- child = spawn(which('shifter'), args, {
+ args.unshift(util.shifter);
+
+ child = spawn(process.execPath, args, {
cwd: path.join(shifter.cwd(), '../', job)
});
View
2 lib/module.js
@@ -709,7 +709,7 @@ var exec = function (exec, name, callback) {
if (cmdName === 'shifter') {
//Fixing the call to shifter..
p = cmd.split(' ');
- p[0] = '"' + which('shifter') + '"';
+ p[0] = '"' + process.execPath + '" "' + util.shifter + '"';
cmd = p.join(' ');
} else {
p = cmd.split(' ');
View
4 lib/util.js
@@ -24,3 +24,7 @@ var find = function(dir, file, cb) {
};
exports.find = find;
+
+
+
+exports.shifter = path.join(__dirname, '../bin/shifter');
View
7 lib/walk.js
@@ -6,8 +6,8 @@ var log = require('./log'),
path = require('path'),
shifter = require('./'),
spawn = require('child_process').spawn,
- exists = require('./util').exists,
- which = require('which').sync,
+ util = require('./util'),
+ exists = util.exists,
has = function (opt, name) {
return opt.some(function (v) {
return (v === name);
@@ -121,7 +121,8 @@ exports.run = function (options) {
run = function () {
var mod = mods.pop(), child;
if (mod) {
- child = spawn(which('shifter'), args, {
+ args.unshift(util.shifter);
+ child = spawn(process.execPath, args, {
cwd: path.join(shifter.cwd(), mod),
stdio: ['ignore', 'ignore', process.stderr]
});
View
5 lib/watch.js
@@ -1,8 +1,8 @@
var log = require('./log'),
watch = require('watch'),
path = require('path'),
- which = require('which').sync,
shifter = require('./'),
+ util = require('./util'),
timer = require('timethat'),
dirs = [
'assets',
@@ -25,7 +25,8 @@ var build = function (cwd, callback) {
log.warn('change detected while a build is in progress, you\'re too fast for me');
return false;
}
- var child = spawn(which('shifter'), buildArgs, {
+ buildArgs.unshift(util.shifter);
+ var child = spawn(process.execPath, buildArgs, {
cwd: cwd
}), start = new Date();

0 comments on commit b7614dc

Please sign in to comment.
Something went wrong with that request. Please try again.