This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { WriteStream } from 'tty'; | |
type callback = (error: Error | null | undefined) => void; | |
export const captureStream = (stream: WriteStream, nextLines: number, ccb: (data: string) => void): void => { | |
const oldWrite = stream.write; | |
let output = ''; | |
let lines = 0; | |
stream.write = (chunk: unknown, encoding: string | callback, cb?: callback): boolean => { | |
const c = chunk.toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { WriteStream } from 'tty'; | |
type callback = (error: Error | null | undefined) => void; | |
export interface Capture { | |
unhook: () => void; | |
captured: () => string; | |
} | |
export const captureStream = (stream: WriteStream): Capture => { | |
const oldWrite = stream.write; |