thlorenz/dockerify — pull request #1 by mafintosh (2014-04-02 23:49:46+00:00)
Title: Node 0.8 compliance

This PR makes this module work with node 0.8
Currently running the tests with node 0.8 causes the tests to hang.

This reason for was that the input stream passed to the `tar` function in `index.js` was being pipe asynchronously.

``` js
function tar(stream, opts) {
opts = opts || {};
opts.stats = opts.stats || {};

var out = through();

resolveContent(opts, function (err, content) {
if (err) return out.emit('error', err);

[ 'error', 'entry', 'existing-dockerfile', 'overriding-dockerfile' ]
.forEach(function (x) { stream.on(x, out.emit.bind(out, x)) });

// we're piping async here - will sometimes break in 0.8
dockerify(stream, content, opts.stats, opts.strip, opts.override).pipe(out);

})
```

This will sometimes break in 0.8 since we might loose data events. This PR fixes this by always piping the input stream through a streams2 `PassThrough` stream