Comparing version 0.1.0 to 0.1.1
@@ -155,3 +155,3 @@ var fs = require('fs'), | ||
} | ||
return (cacheMeta.taskResults[taskHash] ? cacheMeta.taskResults[taskHash].path : false); | ||
return cacheMeta.taskResults[taskHash].path; | ||
}; | ||
@@ -158,0 +158,0 @@ |
@@ -5,2 +5,11 @@ var fs = require('fs'), | ||
var debugIdentities = []; | ||
function debugId(obj) { | ||
var index = debugIdentities.indexOf(obj); | ||
if(index != -1) return index; | ||
debugIdentities.push(obj); | ||
return debugIdentities.length - 1; | ||
} | ||
exports.parallel = function(tasks, opts) { | ||
@@ -66,7 +75,12 @@ var running = 0, | ||
// read result from cache file | ||
return function(out, done) { | ||
var fn = function(out, done) { | ||
// console.log('create', debugId(fn), task.inputFilePath); | ||
fs.createReadStream(cacheFile) | ||
.once('close', done) | ||
.once('close', function() { | ||
// console.log('in-close', debugId(fn), task.inputFilePath); | ||
done(); | ||
}) | ||
.pipe(out, { end: false}); | ||
}; | ||
return fn; | ||
} | ||
@@ -115,3 +129,7 @@ return task; | ||
// from fn(done) => fn(out, done) | ||
return task(opts.output, onDone); | ||
// console.log('run', debugId(task)); | ||
return task(opts.output, function() { | ||
// console.log('done', debugId(task)); | ||
onDone(); | ||
}); | ||
}; | ||
@@ -118,0 +136,0 @@ }), function() { |
@@ -44,2 +44,11 @@ var util = require('util'), | ||
this.inputPaused = true; | ||
// destroy the file handle on 'hit' | ||
// as it will otherwise not be consumed properly and hence never closed | ||
var self = this; | ||
this.once('hit', function() { | ||
if (self._input && self._input.destroy) { | ||
self._input.destroy(); | ||
} | ||
}); | ||
} | ||
@@ -46,0 +55,0 @@ |
{ | ||
"name": "minitask", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A standard/convention for running tasks over a list of files based around Node core streams2", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -69,2 +69,6 @@ var fs = require('fs'), | ||
assert.ok(!cache.lookup(__dirname+'/fixtures/hash.txt', taskHash)); | ||
}, | ||
'can call Cache.lookup(url)': function() { | ||
} | ||
@@ -71,0 +75,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
55449
1208
9