Use eachline@3.0.5 from npm instead of our own fork.

The pull request corresponding to our fork is not going to be merged, so
it's better to use the alternative this.finished API available in newer
versions of the upstream package.

https://github.com/williamkapke/node-eachline/pull/4
This commit is contained in:
Ben Newman
2017-07-13 16:02:19 -04:00
parent edefd39f09
commit c253bdd71c
6 changed files with 28 additions and 10 deletions

View File

@@ -22,9 +22,7 @@ var packageJson = {
// These are only used in dev mode (by shell.js) so end-users can avoid
// needing to install them if they use `npm install --production`.
devDependencies: {
// 2.4.0 (more or less, the package.json change isn't committed) plus our PR
// https://github.com/williamwicks/node-eachline/pull/4
eachline: "https://github.com/meteor/node-eachline/tarball/ff89722ff94e6b6a08652bf5f44c8fffea8a21da",
eachline: "3.0.5",
chalk: "0.5.1"
}
};

View File

@@ -47,9 +47,7 @@ var packageJson = {
// workaround from the tool.
"commonmark": "0.15.0",
escope: "3.2.0",
// 2.4.0 (more or less, the package.json change isn't committed) plus our PR
// https://github.com/williamwicks/node-eachline/pull/4
eachline: "https://github.com/meteor/node-eachline/tarball/ff89722ff94e6b6a08652bf5f44c8fffea8a21da",
eachline: "3.0.5",
pathwatcher: "7.1.0",
optimism: "0.3.3",
'lru-cache': '4.0.1',

View File

@@ -147,6 +147,11 @@ export class AndroidRunTarget extends CordovaRunTarget {
loadIsopacket('cordova-support')['logging'];
const logStream = eachline((line) => {
if (! line && this.finished) {
// Skip blank line at end of stream.
return;
}
const logEntry = logFromAndroidLogcatLine(Log, line);
if (logEntry) {
return `${logEntry}\n`;

View File

@@ -85,10 +85,13 @@ _.extend(AppProcess.prototype, {
// Start the app!
self.proc = self._spawn();
// Send stdout and stderr to the runLog
var realEachline = require('eachline');
function eachline(stream, encoding, callback) {
realEachline(stream, encoding, (...args) => void(callback(...args)));
return realEachline(stream, encoding, function (line) {
if (line || ! this.finished) {
callback.apply(this, arguments);
}
});
}
eachline(self.proc.stdout, 'utf8', async function (line) {

View File

@@ -182,6 +182,11 @@ Cp.setUpSocket = function setUpSocket(sock, key) {
sock.pipe(process.stdout);
eachline(sock, "utf8", function(line) {
if (! line && this.finished) {
// Ignore blank lines at the end of the socket stream.
return;
}
self.exitOnClose = line.indexOf(EXITING_MESSAGE) >= 0;
});

View File

@@ -542,11 +542,15 @@ exports.execFileSync = function (file, args, opts) {
var p = child_process.spawn(file, args, opts);
eachline(p.stdout, fiberHelpers.bindEnvironment(function (line) {
process.stdout.write(line + '\n');
if (line || ! this.finished) {
process.stdout.write(line + '\n');
}
}));
eachline(p.stderr, fiberHelpers.bindEnvironment(function (line) {
process.stderr.write(line + '\n');
if (line || ! this.finished) {
process.stderr.write(line + '\n');
}
}));
return {
@@ -577,6 +581,11 @@ exports.execFileAsync = function (file, args, opts) {
var mapper = opts.lineMapper || _.identity;
var logOutput = fiberHelpers.bindEnvironment(function (line) {
if (! line && this.finished) {
// Ignore blank lines at the end of the output stream.
return;
}
if (opts.verbose) {
line = mapper(line);
if (line) {