From 045224d5eb6a41081186c4040bab1570b9d9ad65 Mon Sep 17 00:00:00 2001 From: Florent Date: Tue, 16 Aug 2022 08:06:49 +0200 Subject: Allow continusously printing logs through tail and parse-log --- scripts/parse-log.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/parse-log.ts b/scripts/parse-log.ts index 5a420a46c..6770f090b 100755 --- a/scripts/parse-log.ts +++ b/scripts/parse-log.ts @@ -1,6 +1,7 @@ import { program } from 'commander' import { createReadStream, readdir } from 'fs-extra' import { join } from 'path' +import { stdin } from 'process' import { createInterface } from 'readline' import { format as sqlFormat } from 'sql-formatter' import { inspect } from 'util' @@ -89,7 +90,7 @@ async function run () { function readFile (file: string) { console.log('Opening %s.', file) - const stream = createReadStream(file) + const stream = file === '-' ? stdin : createReadStream(file) const rl = createInterface({ input: stream @@ -117,7 +118,7 @@ function readFile (file: string) { } }) - stream.once('close', () => res()) + stream.once('end', () => res()) }) } -- cgit v1.2.3