From d1c9ed542be03d216edb9de8b237459aa174cc4a Mon Sep 17 00:00:00 2001 From: spalger Date: Tue, 21 Jul 2020 09:58:13 -0700 Subject: [PATCH] pipelines which end with Readable streams never complete, use a Writable instead --- src/dev/build/lib/fs.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/dev/build/lib/fs.ts b/src/dev/build/lib/fs.ts index 7a0fee5b64c1f..3389236c94a13 100644 --- a/src/dev/build/lib/fs.ts +++ b/src/dev/build/lib/fs.ts @@ -19,7 +19,7 @@ import fs from 'fs'; import { createHash } from 'crypto'; -import { pipeline } from 'stream'; +import { pipeline, Writable } from 'stream'; import { resolve, dirname, isAbsolute, sep } from 'path'; import { createGunzip } from 'zlib'; import { inspect, promisify } from 'util'; @@ -32,8 +32,6 @@ import deleteEmpty from 'delete-empty'; import tar, { ExtractOptions } from 'tar'; import { ToolingLog } from '@kbn/dev-utils'; -import { createMapStream } from '../../../legacy/utils'; - const pipelineAsync = promisify(pipeline); const mkdirAsync = promisify(fs.mkdir); const writeFileAsync = promisify(fs.writeFile); @@ -180,7 +178,12 @@ export async function copyAll( base: destination, dot, }), - createMapStream((file) => utimesAsync(file.path, time, time)) + new Writable({ + objectMode: true, + write(file: File, _, cb) { + utimesAsync(file.path, time, time).then(() => cb(), cb); + }, + }) ); } }