logs: use stream.destroy() instead of custom hooks
This commit is contained in:
@@ -277,7 +277,7 @@ async function getLogs(task, options) {
|
||||
|
||||
const cp = logs.tail([`${paths.TASKS_LOG_DIR}/${task.id}.log`], { lines: options.lines, follow: options.follow });
|
||||
const logStream = new logs.LogStream({ format: options.format || 'json', source: task.id });
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user