logs: use stream.destroy() instead of custom hooks

This commit is contained in:
Girish Ramakrishnan
2024-02-24 17:18:38 +01:00
parent 0e83658aa3
commit 13e62bc738
10 changed files with 19 additions and 10 deletions

View File

@@ -2050,7 +2050,7 @@ async function getLogs(app, options) {
const cp = logs.tail(logPaths, { lines: options.lines, follow: options.follow });
const logStream = new logs.LogStream({ format: options.format || 'json', source: appId });
logStream.close = cp.terminate; // closing stream kills the child process
logStream.on('close', () => cp.terminate()); // the caller has to call destroy() on logStream. destroy() of Transform emits 'close'
cp.stdout.pipe(logStream);