lint
This commit is contained in:
+4
-4
@@ -6,7 +6,7 @@ import path from 'node:path';
|
||||
import safe from 'safetydance';
|
||||
import _ from './underscore.js';
|
||||
|
||||
const { log, trace } = logger('shell');
|
||||
const { log } = logger('shell');
|
||||
|
||||
function lineCount(buffer) {
|
||||
assert(Buffer.isBuffer(buffer));
|
||||
@@ -33,7 +33,7 @@ function spawn(tag, file, args, options) {
|
||||
log(`${tag}: ${file} ${args.join(' ').replace(/\n/g, '\\n')}`);
|
||||
|
||||
const maxLines = options.maxLines || Number.MAX_SAFE_INTEGER;
|
||||
const logger = options.logger || null;
|
||||
const outputLogger = options.logger || null;
|
||||
const abortSignal = options.abortSignal || null; // note: we use our own handler and not the child_process one
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -43,13 +43,13 @@ function spawn(tag, file, args, options) {
|
||||
let stdoutLineCount = 0, stderrLineCount = 0, killTimerId = null, timedOut = false, terminated = false;
|
||||
|
||||
cp.stdout.on('data', (data) => {
|
||||
if (logger) return logger(data);
|
||||
if (outputLogger) return outputLogger(data);
|
||||
stdoutBuffers.push(data);
|
||||
stdoutLineCount += lineCount(data);
|
||||
if (stdoutLineCount >= maxLines) return cp.kill('SIGKILL');
|
||||
});
|
||||
cp.stderr.on('data', (data) => {
|
||||
if (logger) return logger(data);
|
||||
if (outputLogger) return outputLogger(data);
|
||||
stderrBuffers.push(data);
|
||||
stderrLineCount += lineCount(data);
|
||||
if (stderrLineCount >= maxLines) return cp.kill('SIGKILL');
|
||||
|
||||
Reference in New Issue
Block a user