From 41224865e2bd852a3968b824b58a3814e1be4805 Mon Sep 17 00:00:00 2001 From: igorklopov Date: Mon, 12 Sep 2016 18:59:16 +0300 Subject: [PATCH] show lines if they contain just a zero number --- lib/log.js | 11 ++++++----- lib/spawn.js | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/log.js b/lib/log.js index aa17be6..061eac5 100644 --- a/lib/log.js +++ b/lib/log.js @@ -4,6 +4,7 @@ import chalk from 'chalk'; class Log { _lines (lines) { + if (lines === undefined) return; if (!Array.isArray(lines)) { console.log(` ${lines}`); return; @@ -16,23 +17,23 @@ class Log { debug (text, lines) { if (!this.debugMode) return; console.log(`> ${chalk.green('[debug]')} ${text}`); - if (lines) this._lines(lines); + this._lines(lines); } info (text, lines) { console.log(`> ${text}`); - if (lines) this._lines(lines); + this._lines(lines); } warn (text, lines) { console.log(`> ${chalk.blue('Warning')} ${text}`); - if (lines) this._lines(lines); + this._lines(lines); } error (text, lines) { if (text.stack) text = text.stack; console.log(`> ${chalk.red('Error!')} ${text}`); - if (lines) this._lines(lines); + this._lines(lines); } enableProgress (text) { @@ -64,7 +65,7 @@ class Log { export const log = new Log(); export function wasReported (error, lines) { - if (!error) { + if (error === undefined) { error = new Error('No message'); } else if (typeof error === 'string') { diff --git a/lib/spawn.js b/lib/spawn.js index 7813b98..1920ce5 100644 --- a/lib/spawn.js +++ b/lib/spawn.js @@ -1,5 +1,5 @@ import byline from 'byline'; -import chipo from 'child_process'; +import chip from 'child_process'; import fs from 'fs'; import { log } from './log.js'; @@ -12,7 +12,7 @@ function errorLines (lines) { } export function spawn (cmd, args, opts) { - const child = chipo.spawn(cmd, args, opts); + const child = chip.spawn(cmd, args, opts); const stdout = byline(child.stdout); const stderr = byline(child.stderr); const lines = [];