understream
Advanced tools
Comparing version
// Generated by CoffeeScript 1.6.3 | ||
var Duplex, Process, _, | ||
var Duplex, PassThrough, Process, _, _ref, | ||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
@@ -9,3 +9,3 @@ __hasProp = {}.hasOwnProperty, | ||
Duplex = require('stream').Duplex; | ||
_ref = require('stream'), Duplex = _ref.Duplex, PassThrough = _ref.PassThrough; | ||
@@ -19,2 +19,3 @@ module.exports = Process = (function(_super) { | ||
this.process = process; | ||
this._pipeline = __bind(this._pipeline, this); | ||
this.pipe = __bind(this.pipe, this); | ||
@@ -27,8 +28,25 @@ Process.__super__.constructor.call(this, _(this.stream_opts).extend({ | ||
}); | ||
this.out = new PassThrough(); | ||
this.process.stdout.pipe(this.out, { | ||
end: false | ||
}); | ||
this.process.on('close', function(code, signal) { | ||
if (code !== null && code !== 0) { | ||
_this.emit('error', new Error("exited with code " + code)); | ||
} | ||
if (signal !== null) { | ||
_this.emit('error', new Error("killed by signal " + signal)); | ||
} | ||
return _this.out.end(); | ||
}); | ||
} | ||
Process.prototype.pipe = function(dest, options) { | ||
return this.process.stdout.pipe(dest, options); | ||
return this.out.pipe(dest, options); | ||
}; | ||
Process.prototype._pipeline = function() { | ||
return [this.process.stdin, this.process.stdout, this.process.stderr, this.out]; | ||
}; | ||
Process.prototype._extra_report_string = function() { | ||
@@ -35,0 +53,0 @@ return ("stdin:" + this.process.stdin._writableState.length) + (" pid:" + this.process.pid) + (" stdout:" + this.process.stdout._readableState.length); |
@@ -41,9 +41,10 @@ // Generated by CoffeeScript 1.6.3 | ||
return _this.options.fn(payload, function(err, out) { | ||
if (err) { | ||
if (_this._err == null) { | ||
_this._err = err; | ||
} | ||
} | ||
if (_this._err) { | ||
return setImmediate(cb); | ||
} | ||
if (err) { | ||
_this.end(); | ||
return setImmediate(cb, _this._err = err); | ||
} | ||
if (out !== void 0) { | ||
@@ -50,0 +51,0 @@ _this.push(out); |
{ | ||
"name": "understream", | ||
"version": "0.10.10", | ||
"version": "0.10.11", | ||
"description": "stream helpers", | ||
@@ -32,3 +32,6 @@ "engines": { | ||
"JSONStream": "~0.7.1" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
137328
2.23%91
3.41%1288
1.42%2
100%