Permalink
Browse files

Tweaks and cleanup.

  • Loading branch information...
1 parent 757a8e9 commit fd1c392c783216a2a7b9d41e06ed5456dd854827 @remixz remixz committed Nov 14, 2012
Showing with 8 additions and 8 deletions.
  1. +2 −2 bin/index.js
  2. +6 −6 lib/wizardry.js
View
@@ -2,7 +2,7 @@
var optimist = require('optimist'),
wizardry = require('./../lib/wizardry');
-var callback = function(err) {
+var stdout = function(err) {
if (err) { console.dir(err); };
}
@@ -14,5 +14,5 @@ var argv = optimist.usage('Usage: $0 [images] [task]')
.describe('t', 'Task file used to process images.')
.argv;
-wizardry([__dirname + '/' + argv.i], require('./' + argv.t), callback);
+wizardry([__dirname + '/' + argv.i], require('./' + __dirname + '/' + argv.t), stdout);
View
@@ -37,7 +37,7 @@ module.exports = function (images, task, callback) {
var args = [];
- var cpu = task.threads ? task.threads : require('os').cpus().length;
+ var cpu = task.processes ? task.processes : require('os').cpus().length;
_.defaults(env, {
cpu: cpu
});
@@ -57,13 +57,13 @@ module.exports = function (images, task, callback) {
var args_processed = args.slice(0);
args_processed.push(filename);
var process = spawn('gm', args_processed);
- process.on('exit', function(code) {callback();});
+ process.on('exit', function (code) {
+ if (code !== 0) return callback('Process ended with signal ' + code);
+ callback();
+ });
}, env.cpu);
queue.push(images);
- queue.drain = function(error) {
- if (error) callback(error);
- else callback();
- }
+ queue.drain = callback;
};

0 comments on commit fd1c392

Please sign in to comment.