show lines if they contain just a zero number
This commit is contained in:
parent
c3203ad71b
commit
41224865e2
11
lib/log.js
11
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') {
|
||||
|
||||
@ -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 = [];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user