Skip to content

Commit

Permalink
pipelines which end with Readable streams never complete, use a Writa…
Browse files Browse the repository at this point in the history
…ble instead
  • Loading branch information
spalger committed Jul 21, 2020
1 parent 3be8ffc commit d1c9ed5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/dev/build/lib/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
Expand Down Expand Up @@ -180,7 +178,12 @@ export async function copyAll(
base: destination,
dot,
}),
createMapStream<File>((file) => utimesAsync(file.path, time, time))
new Writable({
objectMode: true,
write(file: File, _, cb) {
utimesAsync(file.path, time, time).then(() => cb(), cb);
},
})
);
}
}
Expand Down

0 comments on commit d1c9ed5

Please sign in to comment.